Skip to content

Commit

Permalink
Add option to easily remove generated files set to be hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzschmid committed Nov 14, 2020
1 parent c2a7bdc commit 9cce9ff
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 9 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ The actual schedule defining when and in which room a talk takes place is stored

:warning: Please note that the generated website can be quite large containing many unnecessary whitespaces. It is recommended to minimize the generated output files before uploading them to a server (e.g. with [minify](https://github.com/tdewolff/minify)).

### Jump Start

In order to be up and running simply use the default content of this repository as an initial base for your new website. After having setup a new Jekyll website copy the following files and folders into the website's folder:

- `_config.example.yml` -> `_config.yml`
Expand All @@ -104,12 +106,24 @@ In order to be up and running simply use the default content of this repository
- `speakers/`
- `talks/`

### Automatic Import

There exists a Python file in this repository, `create_entries.py`, which can be used to import content from a [frab](https://github.com/frab/frab/wiki/Manual#introduction) compatible JSON file or a CSV table and generate the different talk, speakers and room files automatically based on it. Just open your terminal and type `python create_entries.py --help` to show the help and get started.

### Automatic Build

In case you do not want to install the entire Ruby/Jekyll toolchain on your machine you can make use of [GitHub Actions](https://github.com/features/actions), Github's continuous integration platform. This repository contains an example Github Action configuration file which automatically builds and minimizes the website upon adding a new tag. It then attaches the generated website as package to a release for easy downloading. Simply copy the following file to your repository and adapt it to your needs:

- `workflow-example.yml` -> `.github/workflows/main.yml`

Hidden rooms, speakers, or talks are automatically generated in way containing no content. In order to remove these empty files simply add a file called `delete_hidden.sh` to the root with the following content. It will automatically called by the Github Action workflow to delete the files.

```markdown
---
layout: delete_hidden
---
```


## Configuration

Expand Down
25 changes: 25 additions & 0 deletions _layouts/delete_hidden.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

{% if site.conference.location.hide -%}
rm -r rooms
rm -r {{ site.conference.location.url | default: "location" }}
{% else -%}
{%- for room in site.rooms -%}
{%- if room.hide -%}
rm -r {{ room.url | slice: 1, room.url.size }}
{% endif -%}
{%- endfor -%}
{%- endif -%}

{%- for speaker in site.speakers -%}
{%- if speaker.hide -%}
rm -r {{ speaker.url | slice: 1, speaker.url.size }}
{% endif -%}
{%- endfor -%}

{%- for talk in site.talks -%}
{%- if talk.hide -%}
rm -r {{ talk.url | slice: 1, talk.url.size }}
{% endif -%}
{%- endfor %}
rm delete_hidden.sh
9 changes: 6 additions & 3 deletions _layouts/room.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% include partials/header.html %}
{%- assign this_room = page -%}

{%- unless this_room.hide or site.conference.location.hide -%}
{%- include partials/header.html -%}

<!-- title for print: -->
<h1 class="display-5 mb-3 d-none d-print-inline">
Expand All @@ -10,7 +13,6 @@ <h1 class="display-5 mb-3 d-print-none">
{{ site.data.lang[site.conference.lang].location.title | default: "Location" }}
</h1>

{% assign this_room = page %}
{% include partials/navbar_rooms.html %}

{{ content }}
Expand Down Expand Up @@ -60,4 +62,5 @@ <h5 class="mt-4 mb-2">

</ul>

{% include partials/footer.html %}
{%- include partials/footer.html -%}
{%- endunless -%}
8 changes: 5 additions & 3 deletions _layouts/speaker.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% include partials/header.html %}
{%- assign speaker = page -%}

{% assign speaker = page %}
{%- unless speaker.hide -%}
{%- include partials/header.html -%}

<p class="h6">
{{ site.data.lang[site.conference.lang].speaker.title | default: "Speaker" }}
Expand Down Expand Up @@ -104,4 +105,5 @@ <h5 class="mt-4 mb-1">{{ site.data.lang[site.conference.lang].speaker.talks | de
</a>
</p>

{% include partials/footer.html %}
{%- include partials/footer.html -%}
{%- endunless -%}
8 changes: 5 additions & 3 deletions _layouts/talk.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% include partials/header.html %}
{%- assign talk = page -%}

{% assign talk = page %}
{%- unless talk.hide -%}
{%- include partials/header.html -%}

<div class="d-flex flex-lg-row flex-column container-fluid mb-2 p-0">
<div class="h6 mt-2 mb-0 mr-1 pr-1 pb-1">
Expand Down Expand Up @@ -119,4 +120,5 @@ <h5 class="mt-4 mb-1">{{ site.data.lang[site.conference.lang].more_information |
</a>
</p>

{% include partials/footer.html %}
{%- include partials/footer.html -%}
{%- endunless -%}
4 changes: 4 additions & 0 deletions workflow-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ jobs:
run: |
bundle exec jekyll build -d _site/
- name: Remove empty files
run: |
[ -f _site/delete_hidden.sh ] || /bin/bash _site/delete_hidden.sh
- name: Install Minify
run: |
sudo apt-get update
Expand Down

0 comments on commit 9cce9ff

Please sign in to comment.