diff --git a/README.md b/README.md index ba8c9ea..45cc53d 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This theme is based on Hugo theme [hugo-paper](https://github.com/nanxiaobei/hug - Easy to use and modify - No preset limits (This theme does not limit your content directory structure, taxonomy names, etc. It's applicable to all zola sites.) +- Inject support - Dark mode - Responsive design - Social icons @@ -49,6 +50,20 @@ theme = "kita" See the `extra` section in [config.toml](https://github.com/st1020/kita/blob/main/config.toml) as a example. +## Inject support + +You can easily use inject to add new features to your side without modifying the theme itself. + +To use inject, you need to add some HTML files to the `templates/injects` directory. + +The available inject points are: `head`, `header_nav`, `body_start`, `body_end`, `page_start`, `page_end`, `footer`, `page_info`. + +For example, to load a custom script, you can add a `templates/injects/head.html` file: + +```html + +``` + ## License [MIT License](https://github.com/st1020/kita/blob/main/LICENSE) diff --git a/templates/index.html b/templates/index.html index a557258..a84afab 100644 --- a/templates/index.html +++ b/templates/index.html @@ -5,6 +5,9 @@ {% include "partials/header.html" %} + + {% include "injects/body_start.html" ignore missing %} +
@@ -20,5 +23,8 @@
{% include "partials/footer.html" %} + + + {% include "injects/body_end.html" ignore missing %} diff --git a/templates/page.html b/templates/page.html index 78965b9..7fd237b 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,6 +1,9 @@ {% extends "index.html" %} {% block main %}
+ + {% include "injects/page_start.html" ignore missing %} +

{{ page.title }}

{% include "partials/page_info.html" %} @@ -34,5 +37,8 @@

{{ page.title }}

{% if page.extra.comment | default(value=config.extra.comment) %} {% include "partials/comment.html" %} {% endif %} + + + {% include "injects/page_end.html" ignore missing %}
{% endblock main %} diff --git a/templates/partials/footer.html b/templates/partials/footer.html index db0c62a..2e35553 100644 --- a/templates/partials/footer.html +++ b/templates/partials/footer.html @@ -1,12 +1,14 @@ diff --git a/templates/partials/head.html b/templates/partials/head.html index d6ba22d..136c4e5 100644 --- a/templates/partials/head.html +++ b/templates/partials/head.html @@ -141,4 +141,7 @@ + + + {% include "injects/head.html" ignore missing %} diff --git a/templates/partials/header.html b/templates/partials/header.html index 84524dc..d1bdfdd 100644 --- a/templates/partials/header.html +++ b/templates/partials/header.html @@ -79,6 +79,8 @@ {% endfor %} + + {% include "injects/header_nav.html" ignore missing %} {% endif %} diff --git a/templates/partials/page_info.html b/templates/partials/page_info.html index a7d3baa..50b65ca 100644 --- a/templates/partials/page_info.html +++ b/templates/partials/page_info.html @@ -13,4 +13,6 @@ · {{ author }} {% endif %} + + {% include "injects/page_info.html" ignore missing %}