diff options
Diffstat (limited to 'src/themes/serene/templates/home.html')
| -rw-r--r-- | src/themes/serene/templates/home.html | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/src/themes/serene/templates/home.html b/src/themes/serene/templates/home.html index f899884..e074268 100644 --- a/src/themes/serene/templates/home.html +++ b/src/themes/serene/templates/home.html @@ -4,22 +4,28 @@ {% block lang %}{% if section.extra.lang %}{{ section.extra.lang }}{% else %}{{ section.lang }}{% endif %}{% endblock lang %} {% block title %}{{ config.title }}{% endblock title %} {% block desc %} - <meta name="description" content="{{ config.description }}"> + {%- if section.extra.lang %}{% set og_lang = section.extra.lang %}{% else %}{% set og_lang = section.lang %}{% endif -%} + {{ <seo config + title={config.title} + desc={config.description} + url={get_url(path="/")} + lang={og_lang} /> }} {% endblock desc %} {% block head %} -{% if config.markdown.highlight_theme == "css" %} - {% if config.extra.force_theme == "dark" %} - <link id="hl" rel="stylesheet" type="text/css" href="{{ get_url(path='hl-dark.css') }}" /> +{% if config.markdown.highlighting.style == "class" %} + {% if color_scheme == "dark" %} + <link id="hl" rel="stylesheet" type="text/css" href="{{ get_url(path='giallo-dark.css') }}" /> {% else %} - <link id="hl" rel="stylesheet" type="text/css" href="{{ get_url(path='hl-light.css') }}" /> + <link id="hl" rel="stylesheet" type="text/css" href="{{ get_url(path='giallo-light.css') }}" /> {% endif %} {% endif %} -{% if section.extra.math %} -<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous"> -<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script> -<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script> -<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" integrity="sha384-HORx6nWi8j5/mYA+y57/9/CZc5z8HnEw4WUZWy5yOn9ToKBv1l58vJaufFAn9Zzi" crossorigin="anonymous"></script> +{% set enable_math = section.extra.math if section.extra.math is defined else (config.extra.math if config.extra.math is defined else false) %} +{% if enable_math %} +<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.18.6/dist/katex.min.css" integrity="sha384-M59ezskvvpvT+a+C1x088YJ3DVmK+wZdX0UkVKalOI4Qi5Nwv0WrvpqHcfa2HQqB" crossorigin="anonymous"> +<script defer src="https://cdn.jsdelivr.net/npm/katex@0.18.6/dist/katex.min.js" integrity="sha384-7jGyG5zFwmEamqNWdCbpsPn+GTWEis3lnV7X/jXHyhFpJG7ExABLyMapabg8F4+p" crossorigin="anonymous"></script> +<script defer src="https://cdn.jsdelivr.net/npm/katex@0.18.6/dist/contrib/auto-render.min.js" integrity="sha384-bjyGPfbij8/NDKJhSGZNP/khQVgtHUE5exjm4Ydllo42FwIgYsdLO2lXGmRBf5Mz" crossorigin="anonymous"></script> +<script defer src="https://cdn.jsdelivr.net/npm/katex@0.18.6/dist/contrib/copy-tex.min.js" integrity="sha384-Pe2JWbaShhSRT0SESJ9XLPeAsi4yrNi7r/CiH0Coq7giBjK5a6Ae7XcybE8rNlQP" crossorigin="anonymous"></script> <script> document.addEventListener("DOMContentLoaded", function () { renderMathInElement(document.body, { @@ -40,36 +46,40 @@ <div id="wrapper"> <main> <section id="info"> - {% if section.extra.avatar %} - <img src="{{ get_url(path=section.extra.avatar) }}" alt="avatar"> + {% if config.extra.avatar %} + <img src="{{ get_url(path=config.extra.avatar) }}" alt="avatar"> {% endif %} <div id="text"> <div> - <span id="name">{{ section.extra.name }}</span> - {% if section.extra.id %} - <span id="id">@{{ section.extra.id }}</span> + <span id="name">{{ config.extra.name }}</span> + {% if config.extra.handle %} + <span id="id">@{{ config.extra.handle }}</span> {% endif %} </div> - {% if section.extra.bio %} - <div id="bio"> {{ section.extra.bio }} </div> + {% if config.extra.bio %} + <div id="bio"> {{ config.extra.bio }} </div> {% endif %} </div> </section> <section id="links"> <div id="left"> - {% for section in config.extra.sections %} - <a {% if section.is_external %}href="{{ section.path }}" target="_blank" rel='noreferrer noopener'{% else %}href="{{ get_url(path=section.path) }}" class="instant"{% endif %}>{{ section.name }}</a> + {% for item in config.extra.nav %} + {% if item.path is starting_with(pat="/") and item.path is not starting_with(pat="//") %} + <a href="{{ get_url(path=item.path) }}" class="instant">{{ item.name }}</a> + {% else %} + <a href="{{ item.path }}" class="external" target="_blank" rel='noreferrer noopener'>{{ item.name }}</a> + {% endif %} {% endfor %} </div> <div id="right"> - {% for link in section.extra.links %} - <a href="{{ link.url }}" aria-label="{{ link.name }}" target="_blank" rel='noreferrer noopener'> + {% for link in config.extra.links %} + <a href="{{ link.url }}" aria-label="{{ link.name }}" target="_blank" rel='noreferrer noopener{% if link.rel_me%} me{% endif %}'> {% set icon_path = "icon/" ~ link.icon ~ ".svg" %} {% set icon = load_data(path=icon_path) %} {{ icon | safe }} </a> {% endfor %} - {% if not section.extra.footer and not config.extra.force_theme %} + {% if not section.extra.footer and color_scheme == "auto" %} {% set moon_icon = load_data(path="icon/moon.svg") %} {% set sun_icon = load_data(path="icon/sun.svg") %} <button id="theme-toggle" aria-label="theme switch"> @@ -83,16 +93,16 @@ {{ section.content | trim | safe }} </section> {% if section.extra.recent %} - {% set blog_section_path = config.extra.blog_section_path | trim_start_matches(pat="/") %} + {% set blog_section_path = config.extra.blog_section_path | trim_start(pat="/") %} {% set section_md_path = blog_section_path ~ "/_index.md" %} {% set blog_section = get_section(path=section_md_path) %} + {% set date_format = section.extra.date_format if section.extra.date_format is defined else (config.extra.date_format if config.extra.date_format is defined else "%b %-d, %Y") %} <section class="layout-list"> <div class="post-list"> - {% for post in blog_section.pages | slice(end=section.extra.recent_max) %} - <a class="post instant {% if post.extra.featured %}featured{% endif %}" href="{{ post.permalink | safe }}"> + {% for post in blog_section.pages[:section.extra.recent_max] %} + <a class="post instant {% if post.extra.featured %}featured{% endif %}" href="{{ post.permalink }}"> <span>{{ post.title }}</span> - <span class="line"></span> - <span class="date">{{ post.date | date(format=section.extra.date_format) }}</span> + <span class="date">{{ post.date | date(format=date_format) }}</span> </a> {% endfor %} </div> @@ -110,9 +120,10 @@ {% block script %} <script src="{{ get_url(path='js/lightense.min.js') }}"></script> -{% if section.extra.mermaid %} +{% set enable_mermaid = section.extra.mermaid if section.extra.mermaid is defined else (config.extra.mermaid if config.extra.mermaid is defined else false) %} +{% if enable_mermaid %} <script type="module"> - import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'; + import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.17.2/dist/mermaid.esm.min.mjs'; mermaid.initialize({ startOnLoad: true }); </script> {% endif %} |
