Compare commits

..

2 commits

Author SHA1 Message Date
7474bf04a4 Merge pull request 'update theme and configure search' (#4) from update-theme into main
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Reviewed-on: #4
2024-02-17 14:15:41 -08:00
b5751ff524 update theme and configure search
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ci/woodpecker/pull_request_closed/woodpecker Pipeline was successful
2024-02-17 14:12:17 -08:00
5 changed files with 55 additions and 5 deletions

View file

@ -6,6 +6,7 @@ author = "Salar Rahmanian"
generate_feed = true
compile_sass = true
minify_html = true
build_search_index = true
# 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
@ -19,6 +20,22 @@ taxonomies = [
{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]
highlight_code = true
highlight_theme = "css"

View file

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

View file

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

View file

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

View file

@ -1,6 +1,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="base" content="{{ config.base_url | safe }}">
{# Site title #}
<title>{%- include "partials/title.html" -%}</title>
@ -160,6 +161,33 @@
{%- if config.extra.analytics.service -%}
{%- include "partials/analytics.html" -%}
{%- 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" -%}
</head>