1+ ---
2+ layout: layouts/base.njk
3+ ---
4+ {# Only include the syntax highlighter CSS on blog posts, included with the CSS per-page bundle #}
5+ {%- css %}{% include " node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
6+ {%- css %}{% include " public/css/prism-diff.css" %}{%- endcss %}
7+ {%- css %}
8+ .links-nextprev {
9+ display: flex;
10+ padding: 0;
11+ margin: 0;
12+ list-style: none;
13+ }
14+ .links-nextprev li {
15+ width: 50%;
16+ }
17+ .links-nextprev-next {
18+ text-align: right;
19+ }
20+ .post-metadata {
21+ display: inline-flex;
22+ flex-wrap: wrap;
23+ gap: 2em;
24+ list-style: none;
25+ padding: 0;
26+ margin: 0;
27+ }
28+ .tag {
29+ border: 1px solid var(--border-color);
30+ border-radius: 4px;
31+ background-color: var(--bg-color-secondary);
32+ padding: 0 0.25rem;
33+ transition: background-color 0.3s, border-color 0.3s;
34+ }
35+
36+ .post-header {
37+ margin-top: 1.5rem;
38+ }
39+
40+ {%- endcss %}
41+ <h1 >{{ title }} </h1 >
42+
43+ <ul class =" post-metadata" >
44+ <div >
45+ <i class =" fa-regular fa-calendar" ></i >
46+ <time datetime =" {{ page.date | htmlDateString }}" >{{ page .date | readableDate }} </time >
47+ </div >
48+ <div data-words =" {{ content | striptags | wordcount | formatWords }} words" >
49+ <i class =" fa-regular fa-clock" ></i >
50+ {{ content | striptags | wordcount | readingTime }}
51+ </div >
52+ <div >
53+ <i class =" fa-solid fa-tags" ></i >
54+ {%- for tag in tags | filterTagList %}
55+ {%- set tagUrl %} /tags/{{ tag | slugify }} /{% endset %}
56+ <span class =" tag" ><a href =" {{ tagUrl }}" >{{ tag }} </a ></span >
57+ {%- endfor %}
58+ </div >
59+ </ul >
60+
61+ {%- if image %}
62+ <img src =" {{ image }}" alt =" " class =" post-header" />
63+ {% endif %}
64+
65+ {{ content | safe }}
66+
67+ {% include " partials/socials.njk" %}
68+
69+ {%- if collections .posts %}
70+ {%- set previousPost = collections .posts | getPreviousCollectionItem %}
71+ {%- set nextPost = collections .posts | getNextCollectionItem %}
72+ {%- if nextPost or previousPost %}
73+ <ul class =" links-nextprev" >
74+ <li class =" links-nextprev-prev" >{%- if previousPost %} ← Previous<br > <a href =" {{ previousPost.url }}" >{{ previousPost .data .title }} </a >{% endif %} </li >
75+ <li class =" links-nextprev-next" >{%- if nextPost %} Next →<br ><a href =" {{ nextPost.url }}" >{{ nextPost .data .title }} </a >{% endif %} </li >
76+ </ul >
77+ {%- endif %}
78+ {%- endif %}
79+
80+ {% if metadata .githubComments .repo %}
81+ <div id =" giscus-comments" ></div >
82+ <script >
83+ // Wait for the DOM to load or ensure themeManager is available
84+ document .addEventListener (" DOMContentLoaded" , () => {
85+ const giscusContainer = document .getElementById (" giscus-comments" );
86+
87+ const script = document .createElement (" script" );
88+ script .src = " https://giscus.app/client.js" ;
89+ script .setAttribute (" data-repo" , " {{ metadata.githubComments.repo }}" );
90+ script .setAttribute (" data-repo-id" , " {{ metadata.githubComments.repoId }}" );
91+ script .setAttribute (" data-category-id" , " {{ metadata.githubComments.categoryId }}" );
92+ script .setAttribute (" data-mapping" , " pathname" );
93+ script .setAttribute (" data-strict" , " 0" );
94+ script .setAttribute (" data-reactions-enabled" , " 1" );
95+ script .setAttribute (" data-emit-metadata" , " 0" );
96+ script .setAttribute (" data-input-position" , " top" );
97+ script .setAttribute (" data-theme" , themeManager .get ()); // Use themeManager.get() for theme
98+ script .setAttribute (" data-lang" , " en" );
99+ script .setAttribute (" data-loading" , " lazy" );
100+ script .setAttribute (" crossorigin" , " anonymous" );
101+ script .async = true ;
102+
103+ giscusContainer .appendChild (script); // Append the script to the document
104+ });
105+ </script >
106+ {% endif %}
0 commit comments