update theme and configure search #4

Merged
softinio merged 1 commit from update-theme into main 2024-02-17 14:15:41 -08:00
5 changed files with 55 additions and 5 deletions

View file

@ -6,6 +6,7 @@ author = "Salar Rahmanian"
generate_feed = true generate_feed = true
compile_sass = true compile_sass = true
minify_html = true minify_html = true
build_search_index = true
# To translate the entire theme, there must be a file with the same ISO 639-1 # To translate the entire theme, there must be a file with the same ISO 639-1
# (or IETF BCP 47) Code in the `i18n` folder of your site or the tabi theme # (or IETF BCP 47) Code in the `i18n` folder of your site or the tabi theme
@ -19,6 +20,22 @@ taxonomies = [
{name = "tags", feed = true}, {name = "tags", feed = true},
] ]
[search]
# Whether to include the title of the page/section in the index.
include_title = true
# Whether to include the description of the page/section in the index.
include_description = true
# Whether to include the path of the page/section in the index.
include_path = true
# Whether to include the rendered content of the page/section in the index.
include_content = true
# At which character to truncate the content to. Useful if you have a lot of pages and the index would
# become too big to load on the site. Defaults to not being set.
# truncate_content_length = 100
# Wether to produce the search index as a javascript file or as a JSON file.
# Accepted value "elasticlunr_javascript" or "elasticlunr_json".
index_format = "elasticlunr_json"
[markdown] [markdown]
highlight_code = true highlight_code = true
highlight_theme = "css" highlight_theme = "css"

View file

@ -25,17 +25,17 @@
"theme": { "theme": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1704495088, "lastModified": 1707564545,
"narHash": "sha256-ZfN0qTw2yO+/zU5hkWlB/lOXSJPdcFfVduYUOoSor3A=", "narHash": "sha256-m0XIxf3yKBKJwbSonAPDjw7DPHDi0BgRMhhD3FArWA4=",
"owner": "welpo", "owner": "welpo",
"repo": "tabi", "repo": "tabi",
"rev": "7fa208a2a5dffbc83dd2b71de1e804c2f2eaad01", "rev": "7e428c899b1bf595100e1448578f9cfc84ad3355",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "welpo", "owner": "welpo",
"repo": "tabi", "repo": "tabi",
"rev": "7fa208a2a5dffbc83dd2b71de1e804c2f2eaad01", "rev": "7e428c899b1bf595100e1448578f9cfc84ad3355",
"type": "github" "type": "github"
} }
} }

View file

@ -4,7 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
theme = { theme = {
url = "github:welpo/tabi/7fa208a2a5dffbc83dd2b71de1e804c2f2eaad01"; url = "github:welpo/tabi/7e428c899b1bf595100e1448578f9cfc84ad3355";
flake = false; flake = false;
}; };
}; };

View file

@ -102,5 +102,10 @@
{%- if email_needs_decoding -%} {%- if email_needs_decoding -%}
<script src="{{ get_url(path='js/decodeMail.min.js') }}" async></script> <script src="{{ get_url(path='js/decodeMail.min.js') }}" async></script>
{%- endif -%} {%- endif -%}
{# Modal structure for search #}
{%- if config.build_search_index -%}
{% include "partials/search_modal.html" %}
{%- endif -%}
</footer> </footer>

View file

@ -1,6 +1,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="base" content="{{ config.base_url | safe }}">
{# Site title #} {# Site title #}
<title>{%- include "partials/title.html" -%}</title> <title>{%- include "partials/title.html" -%}</title>
@ -160,6 +161,33 @@
{%- if config.extra.analytics.service -%} {%- if config.extra.analytics.service -%}
{%- include "partials/analytics.html" -%} {%- include "partials/analytics.html" -%}
{%- endif -%} {%- endif -%}
{# Search #}
{%- if config.build_search_index -%}
{%- if config.search.index_format -%}
{%- set search_index_format = config.search.index_format -%}
{%- elif config.extra.index_format -%}
{# Necessary to support Zola 0.17.X, as it doesn't have access to config.search.index_format #}
{# See: https://github.com/getzola/zola/issues/2165 #}
{%- set search_index_format = config.extra.index_format -%}
{%- else -%}
{%- set search_index_format = "elasticlunr_json" -%}
{%- endif -%}
{%- if search_index_format == "elasticlunr_javascript" -%}
<script defer src="{{ get_url(path='search_index.' ~ lang ~ '.js', cachebust=true) | safe }}"></script>
{%- endif -%}
{# Main search script #}
<script defer src="{{ get_url(path='js/searchElasticlunr.min.js', cachebust=true) | safe }}"></script>
{# Support correct stemming and stop word filtering in non-English search #}
{%- if lang != "en" -%}
<script defer src="{{ get_url(path='js/lunr/lunrStemmerSupport.min.js') | safe }}"></script>
<script defer src="{{ get_url(path='js/lunr/lunr.' ~ lang ~ '.min.js') | safe }}"></script>
{%- endif -%}
{%- endif -%}
{%- include "partials/custom_header.html" -%} {%- include "partials/custom_header.html" -%}
</head> </head>