diff --git a/README.md b/README.md index caade58..6077bd5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ As you may have heard Zola is quite flexible :) So, the scenario below is one of 1. Fork the repo and replace demo-content inside content folder with yours. But take a look to _index.md files. It contains `title` and when you want to have anchor right of your headers add `insert_anchor_links = "right"` to each index. `theme.toml`, screenshot and readme may be deleted too. 2. Inside `config.toml` change URL and title on your own. In extra section you can specify path to your GitHub API for version below the logo on nav, favicon and logo itself. Or just remove the lines if you don't need it. Also, you can configure or turn on some additional settings related to Zola. [Specification is here](https://www.getzola.org/documentation/getting-started/configuration/). -3. In sass/_variables.scss you may change font, color or backgound if you want. +3. In sass/_variables.scss you may change font, color or background if you want. 4. Almost done. Now, you should decide how you want to build and where will be hosted your website. You can build it locally and upload to somewhere. Or build in GitHub Actions and host on GitHub Pages / Netlify / CloudFlare Pages / AnyS3CloudStorage. [Howto for GitHub Pages](https://www.getzola.org/documentation/deployment/github-pages/). [My example](https://github.com/o365hq/o365hq.com/blob/main/.github/workflows/main.yml) of GitHub workflow with 2-steps build (the first checks for links and spelling errors, the second uploads to Azure). [Dockerfile](https://github.com/codeandmedia/zola_docsascode_theme/blob/master/Dockerfile) to make Docker image. Enjoy your docs! diff --git a/templates/index.html b/templates/index.html index 32c157f..a1db8ac 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,19 +3,19 @@ - {% if config.extra.favicon %} - {% set _favicon = config.extra.favicon %} - {% if (_favicon is starting_with("http")) == false %} - {% set _favicon = get_url(path=config.extra.favicon) %} - {% endif %} + {% if config.extra.favicon -%} + {% set _favicon = config.extra.favicon -%} + {% if (_favicon is starting_with("http")) == false -%} + {% set _favicon = get_url(path=config.extra.favicon) -%} + {% endif -%} - {% endif %} + {% endif -%} {% block title %}{{ config.title }}{% endblock title %} -{% if config.extra.release %} +{% if config.extra.release -%} -{% endif %} +{% endif -%}
- {% block nav %} + {% block nav -%} - {% endblock nav %} + {% endblock nav -%}
- {% if config.build_search_index %} + {% if config.build_search_index -%}
@@ -126,11 +127,15 @@ - {% endif %} + {% endif -%}
- {% block content %} - {{ section.content | safe }} + {% block content -%} + {%- if section.word_count > 0 -%} + {{ section.content |safe }} + {%- else -%} + {%- include "sec_toc_2_level.html" -%} + {% endif -%} {% endblock content %}
@@ -141,7 +146,7 @@ -{% endif %} +{% endif -%} diff --git a/templates/sec_toc_2_level.html b/templates/sec_toc_2_level.html new file mode 100644 index 0000000..a9e730b --- /dev/null +++ b/templates/sec_toc_2_level.html @@ -0,0 +1,20 @@ +

Table of Contents

+{% if section.subsections -%} + +{% else -%} +

No Sections Found

+{% endif -%} diff --git a/templates/section.html b/templates/section.html index abbf1a2..2fd5dfa 100644 --- a/templates/section.html +++ b/templates/section.html @@ -2,21 +2,33 @@ {% block title %} {{ config.title }} | {{ section.title }} {% endblock title %} - {% block content %} - {% if section.word_count > 0 %} - {{ section.content }} - {% else %} -

- {{ section.title }} -

- Pages: + {% if section.word_count > 0 -%} + {{ section.content | safe }} + {% else -%} +

{{ section.title }}

+ + {% if section.subsections -%} +

Subsections:

+ + {% endif -%} + +

Pages:

- {% endif %} + {% endif -%} {% endblock content %}