Skip to content

Commit

Permalink
generate toml within zola
Browse files Browse the repository at this point in the history
  • Loading branch information
hry-gh committed May 27, 2024
1 parent 6fa65cb commit 4397c64
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 66 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,19 @@ jobs:
with:
tool: [email protected]

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Generate Index Configuration
run: |
python -m pip install toml
python tools/generate_index.py
- name: Install Stork
uses: baptiste0928/[email protected]
with:
crate: stork-search
version: "1.6.0"

- name: Generate Index
run: |
stork build --input tools/stork_input.toml --output static/search.st
- name: Build project
run: npm run build

- name: Generate Index
run: |
stork build --input public/toml/index.html --output public/search.st
- name: Setup Pages
uses: actions/configure-pages@v5

Expand Down
3 changes: 3 additions & 0 deletions content/toml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
+++
template = "toml.html"
+++
Binary file modified static/search.st
Binary file not shown.
28 changes: 28 additions & 0 deletions templates/toml.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% macro toml_recurse(subsectionPath) -%}
{%- set subsection = get_section(path=subsectionPath) -%}
{%- if subsection.subsections -%}
{%- for section in subsection.subsections -%}
{{- self::toml_recurse(subsectionPath=section) -}}
{%- endfor -%}
{%- endif -%}
[[input.files]]
path = "{{subsection.relative_path | safe}}"
title = "{{subsection.title | safe}}"
url = "{{subsection.permalink | safe}}"
{% if subsection.pages -%}
{%- for page in subsection.pages -%}
[[input.files]]
path = "{{page.relative_path | safe}}"
title = "{{page.title | safe}}"
url = "{{subsection.permalink | safe}}"
{% endfor -%}
{%- endif -%}
{% endmacro toml_recurse -%}
[input]
base_directory = "content"
url_prefix = "{{config.base_url | safe }}"

{% set index = get_section(path="_index.md") -%}
{% for subsection in index.subsections -%}
{{ self::toml_recurse(subsectionPath=subsection) -}}
{% endfor %}
1 change: 0 additions & 1 deletion tools/.gitignore

This file was deleted.

49 changes: 0 additions & 49 deletions tools/generate_index.py

This file was deleted.

3 changes: 0 additions & 3 deletions tools/stork_input.toml

This file was deleted.

0 comments on commit 4397c64

Please sign in to comment.