Skip to content

Commit c8c2104

Browse files
committed
fix: add partials/header.html to use giallo syntax theme
this is because zola 0.22 now uses giallo, which generates a different file and zola uses a different config for that. however apollo isn't updated to use giallo syntax files. so I copied header.html and changed the syntax reference
1 parent 3059941 commit c8c2104

3 files changed

Lines changed: 235 additions & 5 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
public
2+
.direnv
3+
static/giallo-*.css

config.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ compile_sass = true
1414
build_search_index = true
1515

1616
[markdown.highlighting]
17-
theme = "css"
18-
themes_css = [
19-
{ theme = "ayu-dark", filename = "syntax-theme-dark.css" },
20-
{ theme = "ayu-light", filename = "syntax-theme-light.css" },
21-
]
17+
style = "class"
18+
light_theme = "catppuccin-latte"
19+
dark_theme = "catppuccin-mocha"
2220

2321
[extra]
2422
toc = true

templates/partials/header.html

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
{% import "macros/macros.html" as post_macros %}
2+
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="base" content="{{ config.base_url }}">
8+
9+
{% if page.extra.meta %}
10+
<!-- the meta data config goes here -->
11+
{% for data in page.extra.meta %}
12+
<meta {% for key, value in data %} {% if key == "property" and value == "og:title" %} {% set_global page_has_og_title = true -%} {% endif %}
13+
{% if key == "property" and value == "og:description" %} {% set_global page_has_og_description = true -%} {% endif %}
14+
{% if key == "name" and value == "description" %} {% set_global page_has_description = true -%} {% endif %}
15+
{{ key }}
16+
None="{{ value }}"
17+
{% endfor %} />
18+
{% endfor %}
19+
{% endif %}
20+
21+
{# Site title #}
22+
{% set current_path = current_path | default(value="/") %}
23+
{% if current_path == "/" %}
24+
<title>{{ post_macros::site_title() }}</title>
25+
{% if not page_has_og_title %}
26+
<meta property="og:title"
27+
content="{{ post_macros::site_title() }}" />
28+
{% endif %}
29+
30+
{% else %}
31+
<title>
32+
{% if page.title %}
33+
{{ page.title }}
34+
{% elif section.title %}
35+
{{ section.title }}
36+
{% elif config.title %}
37+
{{ config.title }}
38+
{% else %}
39+
Post
40+
{% endif %}
41+
</title>
42+
43+
{% if not page_has_og_title %}
44+
<meta property="og:title"
45+
content="{% if page.title -%}{{ page.title }}{% elif config.title -%}{{ config.title }}{% else -%}Post{% endif -%}" />
46+
{% endif %}
47+
{% endif %}
48+
49+
{% if not page_has_og_description %}
50+
{% if page.description %}
51+
<meta property="og:description" content="{{ page.description }}" />
52+
{% elif config.description %}
53+
<meta property="og:description" content="{{ config.description }}" />
54+
{% endif %}
55+
{% endif %}
56+
57+
{% if not page_has_description %}
58+
{% if page.description %}
59+
<meta name="description" content="{{ page.description }}" />
60+
{% elif config.description %}
61+
<meta name="description" content="{{ config.description }}" />
62+
{% endif %}
63+
{% endif %}
64+
65+
{# Favicon #}
66+
{% if config.extra.favicon %}<link rel="icon" type="image/png" href={{ get_url(path=config.extra.favicon) }} />{% endif %}
67+
68+
{# Font from cdn or disk #}
69+
{% if config.extra.use_cdn | default(value=false) %}
70+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
71+
<link rel="stylesheet"
72+
href="https://cdn.jsdelivr.net/npm/jetbrains-mono@1.0.6/css/jetbrains-mono.min.css">
73+
<link rel="stylesheet"
74+
href="https://cdn.jsdelivr.net/npm/@fontsource/space-grotesk@4.5.8/index.min.css">
75+
{% else %}
76+
<link href={{ get_url(path="fonts.css") }} rel="stylesheet" />
77+
{% endif %}
78+
79+
{# Syntax theme #}
80+
<link rel="stylesheet" type="text/css" href="/giallo-dark.css" media="(prefers-color-scheme: dark)" />
81+
<link rel="stylesheet" type="text/css" href="/giallo-light.css" media="(prefers-color-scheme: light)" />
82+
83+
{# Analytics #}
84+
{% if config.extra.analytics.enabled %}
85+
{% if config.extra.analytics.umami.website_id %}
86+
{% set website_id = config.extra.analytics.umami.website_id %}
87+
{% set host_url = config.extra.analytics.umami.host_url | default(value="https://api-gateway.umami.dev/") %}
88+
89+
<script defer
90+
src="/js/imamu.js"
91+
data-website-id="{{ website_id }}"
92+
data-host-url="{{ host_url }}"></script>
93+
{% endif %}
94+
95+
{% if config.extra.analytics.goatcounter.user %}
96+
{% set user = config.extra.analytics.goatcounter.user %}
97+
{% set host = config.extra.analytics.goatcounter.host | default(value="goatcounter.com") %}
98+
99+
<script data-goatcounter="https://{{ user }}.{{ host }}/count"
100+
async
101+
src="{{ get_url(path="js/count.js") }}"></script>
102+
<noscript>
103+
{# EasyList blocks '.com/count?', so we have to use '.com//count' #}
104+
<img src="https://{{ user }}.{{ host }}//count?p={{ current_path }}&t={{ page.title | default(value=config.title) }}">
105+
</noscript>
106+
{% endif %}
107+
{% endif %}
108+
109+
{# Fancy Codeblock #}
110+
{% if config.extra.fancy_code %}<script defer src={{ get_url(path="js/codeblock.js") }}></script>{% endif %}
111+
112+
{# Table of contents #}
113+
{% if config.extra.toc | default(value=false) %}<script defer src={{ get_url(path="js/toc.js") }}></script>{% endif %}
114+
115+
{# Dynamic Note #}
116+
{% if config.extra.dynamic_note | default(value=false) %}
117+
<script src={{ get_url(path="js/note.js") }}></script>
118+
{% endif %}
119+
120+
{% if config.extra.mathjax | default(value=false) %}
121+
{% if config.extra.mathjax_dollar_inline_enable | default(value=false) %}
122+
<script>
123+
MathJax = {
124+
tex: {
125+
inlineMath: [['$', '$'], ['\\(', '\\)']]
126+
}
127+
};
128+
</script>
129+
{% endif %}
130+
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
131+
</script>
132+
{% endif %}
133+
134+
{# RSS #}
135+
{% if config.generate_feeds %}
136+
{% for feed_filenames in config.feed_filenames %}
137+
{% if feed_filenames == "atom.xml" %}
138+
<link rel="alternate"
139+
type="application/atom+xml"
140+
title="{{ post_macros::site_title() }}"
141+
href="{{ get_url(path="atom.xml", trailing_slash=false) }}" />
142+
{% elif feed_filenames == "rss.xml" %}
143+
<link rel="alternate"
144+
type="application/rss+xml"
145+
title="{{ post_macros::site_title() }}"
146+
href="{{ get_url(path="rss.xml", trailing_slash=false) }}" />
147+
{% endif %}
148+
{% endfor %}
149+
{% endif %}
150+
151+
152+
{% set theme = config.extra.theme | default(value="toggle") %}
153+
{% if theme == "dark" %}
154+
<link rel="stylesheet"
155+
type="text/css"
156+
href="{{ get_url(path='theme/dark.css') }}" />
157+
{% elif theme == "light" %}
158+
<link rel="stylesheet"
159+
type="text/css"
160+
href="{{ get_url(path="theme/light.css") }}" />
161+
{% elif theme == "auto" %}
162+
<link rel="stylesheet"
163+
type="text/css"
164+
href="{{ get_url(path="theme/light.css") }}" />
165+
<link rel="stylesheet"
166+
type="text/css"
167+
href="{{ get_url(path='theme/dark.css') }}"
168+
media="(prefers-color-scheme: dark)" />
169+
{% elif theme == "toggle" %}
170+
<link rel="stylesheet"
171+
type="text/css"
172+
href="{{ get_url(path="theme/light.css") }}" />
173+
<link id="darkModeStyle"
174+
rel="stylesheet"
175+
type="text/css"
176+
href="{{ get_url(path='theme/dark.css') }}" />
177+
{% endif %}
178+
179+
<!-- Set the correct theme in the script -->
180+
181+
{% if theme == "auto" or theme == "toggle" %}
182+
<script src={{ get_url(path="js/themetoggle.js") }}></script>
183+
184+
{% if theme == "auto" %}
185+
<script>
186+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
187+
setTheme("dark");
188+
} else {
189+
setTheme("light");
190+
}
191+
</script>
192+
{% else %}
193+
<script>setTheme(getSavedTheme());</script>
194+
{% endif %}
195+
{% endif %}
196+
197+
198+
<link rel="stylesheet"
199+
type="text/css"
200+
media="screen"
201+
href="{{ get_url(path="main.css") }}" />
202+
203+
{% if config.extra.stylesheets %}
204+
{% for stylesheet in config.extra.stylesheets %}
205+
<link rel="stylesheet" href="{{ get_url(path=stylesheet) }}">
206+
{% endfor %}
207+
{% endif %}
208+
209+
{# Search #}
210+
{%- if config.build_search_index -%}
211+
{%- if config.search.index_format -%}
212+
{%- set search_index_format = config.search.index_format -%}
213+
{%- elif config.extra.index_format -%}
214+
{# Necessary to support Zola 0.17.X, as it doesn't have access to config.search.index_format #}
215+
{# See: https://github.com/getzola/zola/issues/2165 #}
216+
{%- set search_index_format = config.extra.index_format -%}
217+
{%- else -%}
218+
{%- set search_index_format = "elasticlunr_json" -%}
219+
{%- endif -%}
220+
221+
{%- if search_index_format == "elasticlunr_javascript" -%}
222+
<script defer
223+
src="{{ get_url(path='search_index.' ~ lang ~ '.js', cachebust=true) | safe }}"></script>
224+
{%- endif -%}
225+
226+
{# Main search script #}
227+
<script defer
228+
src="{{ get_url(path='js/searchElasticlunr.min.js', cachebust=true) | safe }}"></script>
229+
{%- endif -%}
230+
</head>

0 commit comments

Comments
 (0)