diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/404.html | 0 | ||||
-rw-r--r-- | templates/archives.html | 28 | ||||
-rw-r--r-- | templates/base.html | 68 | ||||
-rw-r--r-- | templates/home.html | 29 | ||||
-rw-r--r-- | templates/macros.html | 16 | ||||
-rw-r--r-- | templates/navbar.html | 16 | ||||
-rw-r--r-- | templates/page.html | 61 | ||||
-rw-r--r-- | templates/section.html | 42 | ||||
-rw-r--r-- | templates/shortcodes/shikwasa.html | 16 |
9 files changed, 276 insertions, 0 deletions
diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/templates/404.html diff --git a/templates/archives.html b/templates/archives.html new file mode 100644 index 0000000..e691c86 --- /dev/null +++ b/templates/archives.html @@ -0,0 +1,28 @@ +{% extends "base.html" %} + +{% block content %} +<section class="archive"> + <ul class="post-archive"> + {# Group the posts by year #} + {% set map = get_section(path="_index.md") | get(key="pages") | group_by(attribute="year") %} + {% set_global years = [] %} + {# Convert the years map to an array (since maps do not have determined order) #} + {% for year, ignored in map %} + {% set_global years = years | concat(with=year) %} + {% endfor %} + + {% for year in years | sort | reverse %} + <div class="years"> + {% set posts = map[year] %} + <div class="year">{{ year }}</div> + {% for post in posts %} + <li class="post-item"> + <span class="post-date">{{ post.date | date(format="%m/%d") }}</span> + <a href="{{ post.permalink }}" class="post-title">{{ post.title }}</a> + </li> + {% endfor %} + </div> + {% endfor %} + </ul> +</section> +{% endblock %} diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..eef6a39 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,68 @@ +<!DOCTYPE html> +<html> +<head> + {% set sub_title = section.title | default(value=page.title | default(value='')) %} + {% if sub_title %} + {% set title = sub_title ~ ' - ' ~ trans(key="title") %} + {% else %} + {% set title = trans(key="title") %} + {% endif %} + {% set cn_font_family = "'Source Serif Pro', 'Source Han Serif SC', 'Noto Serif CJK SC', 'Noto Serif SC', serif" %} + {% set fallback_font_family = "'Source Serif Pro', 'Source Han Serif TC', 'Noto Serif CJK TC', 'Noto Serif TC', 'Noto Serif KR', 'Noto Serif SC', serif" %} + {% set fonts_url = "Noto+Serif+SC:wght@400;700" %} + {% set font_base_url = config.extra.seje_font_mirror | default(value="fonts.googleapis.com") %} + {% if lang == 'zh-cn' and not config.extra.seje_vertical_layout %} + {% set font_family = cn_font_family %} + {% else %} + {% set font_family = fallback_font_family %} + {% set fonts_url = "Noto+Serif+TC:wght@400;700&family=Noto+Serif+KR:wght@400;700&" ~ fonts_url %} + {% endif %} + {% if config.extra.seje_custom_fonts %} + {% set font_family = config.extra.seje_custom_fonts ~ ',' ~ font_family %} + {% endif %} + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport"> + <title>{{ title }}</title> + <meta charset="utf-8"> + <meta name="title" content="{{ title }}"> + <meta name="description" content="{{ section.description | default(value=page.description | default(value=config.description)) }}"> + <meta property="og:image:width" content="200" /> + <meta property="og:image:height" content="200" /> + <link rel="stylesheet" href="{{ config.base_url }}/style.css"> + {% if config.extra.seje_darkmode == "auto" %} + <link rel="stylesheet" href="{{ config.base_url }}/autodarkmode.css"> + {% elif config.extra.seje_darkmode == "always" %} + <link rel="stylesheet" href="{{ config.base_url }}/darkmode.css"> + {% endif %} + {% if config.extra.seje_vertical_layout %} + <link rel="stylesheet" href="{{ config.base_url }}/vertical.css"> + {% else %} + <style> + @media screen and (min-width: 320px) { + body { + font-size: calc(16px + 2 * ((100vw - 320px) / 960)); + } + } + </style> + {% endif %} + <link rel="stylesheet" href="https://{{ font_base_url }}/css2?family=Source+Serif+Pro:wght@400;700&display=swap"> + <link rel="stylesheet" href="https://{{ font_base_url }}/css2?family={{ fonts_url }}&display=swap"> + <style>body { font-family: {{ font_family | safe }} }</style> + {% block metadata %}{# <meta property="og:image" content="/<%= theme.favicon %>"> #}{% endblock %} +</head> +<body> + {% block header %} + <header class="header"> + <div class="blog-title"><a href="{{ config.base_url }}" class="logo">{{ trans(key="title") }}</a></div> + {% include "navbar.html" %} + </header> + {% endblock %} + <main class="main"> + {% block content %} + {% endblock %} + </main> + {% block footer %} + <p class="license">{{ config.license | default(value='') }}</p> + {% endblock %} +</body> +</html> diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..25c3032 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% import "macros.html" as macros %} + +{% block content %} +<section class="posts"> + {% for post in paginator.pages %} + <article class="post"> + <div class="post-title"><a href="{{ post.permalink }}" class="post-title-link">{{ post.title }}</a></div> + <div class="post-content"> + {% if config.extra.seje_show_summary_only %} + {{ post.summary }} + <a href="{{ post.permalink }}" class="More">More</a> + {% else %} + {{ post.content | safe }} + {% endif %} + </div> + <div class="post-meta"> + {% if config.extra.seje_chinese_date %} + {{ macros::format_chinese_date(year=post.year, month=post.month, day=post.day) }} + {% else %} + {{ post.date|date(format="%Y/%m/%d") }} + {% endif %} + </div> + </article> + {% endfor %} +{{ paginator.next }} +</section> +{% endblock %} diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..7379b1b --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,16 @@ +{% macro format_chinese_date(year, month, day) %} +{% set lut1 = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"] %} +{% set lut2 = [ + '一', '二', '三', '四', + '五', '六', '七', '八', + '九', '十', '十一', '十二', + '十三', '十四', '十五', '十六', + '十七', '十八', '十九', '二十', + '廿一', '廿二', '廿三', '廿四', + '廿五', '廿六', '廿七', '廿八', + '廿九', '三十', '三十一'] %} +{% for c in year | as_str %} + {{ lut1 | nth(n=c | int) }} +{% endfor %} +年{{ lut2 | nth(n=month-1)}}月{{ lut2 | nth(n=day-1) }}日 +{% endmacro %} diff --git a/templates/navbar.html b/templates/navbar.html new file mode 100644 index 0000000..e50799d --- /dev/null +++ b/templates/navbar.html @@ -0,0 +1,16 @@ +<nav class="navbar"> + <ul class="menu"> + {% set data = config.extra.seje_menu_links %} + {% for item in data %} + <li class="menu-item"> + {% set url = item['url'] ~ '/'%} + {% set path = page.path|default(value = section.path) %} + {% if url == path or item['url'] == path %} + <a href="{{ item['url'] }}" class="current-menu-item-link">{{ trans(key=item['name']) }}</a> + {% else %} + <a href="{{ item['url'] }}" class="menu-item-link">{{ trans(key=item['name']) }}</a> + {% endif %} + </li> + {% endfor %} + </ul> +</nav> diff --git a/templates/page.html b/templates/page.html new file mode 100644 index 0000000..48a1c74 --- /dev/null +++ b/templates/page.html @@ -0,0 +1,61 @@ +{% extends "base.html" %} + +{% import "macros.html" as macros %} + +{% block content %} +<article class="post"> + <div class="post-title"> + <h1 class="title">{{ page.title }}</h1> + </div> + <div class="post-content"> + {{ page.content | safe }} + </div> + <div class="post-meta"> + <span class="post-time"> + {% if config.extra.seje_chinese_date %} + {{ macros::format_chinese_date(year=page.year, month=page.month, day=page.day) }} + {% else %} + {{ page.date|date(format="%Y/%m/%d") }} + {% endif %} + </span> + </div> +</article> + +<div class="prev_next"> +<nav id="prev_next"> + <div class="prev"> + {% if page.later %} + <p>Newer</p><a href="{{ page.later.permalink }}"><div class="article-nav-title">{{ page.later.title }}</div></a> + {% endif %} + </div> + <div class="next"> + {% if page.earlier %} + <p>Older</p><a href="{{ page.earlier.permalink }}"><div class="article-nav-title">{{ page.earlier.title }}</div></a> + {% endif %} + </div> +</nav> +</div> + +<div class="post-comment"> +{# Discussion #} +{% block comment %} +{% if config.seje_disqus_shortname %} +<section id="comments"> + <div id="disqus_thread"></div> + <script type="text/javascript"> + /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ + var disqus_shortname = "{{ config.seje_disqus_shortname }}"; // required: replace example with your forum shortname + /* * * DON'T EDIT BELOW THIS LINE * * */ + (function () { + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + </script> + <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered + by Disqus.</a></noscript> +</section> +{% endif %} +{% endblock %} +</div> +{% endblock %} diff --git a/templates/section.html b/templates/section.html new file mode 100644 index 0000000..bca7f6b --- /dev/null +++ b/templates/section.html @@ -0,0 +1,42 @@ +{% extends "base.html" %} + +{% import "macros.html" as macros %} + +{% block content %} +<article class="post"> + <div class="post-title"> + <h1 class="title">{{ section.title }}</h1> + </div> + <div class="post-content"> + {{ section.content | safe }} + </div> + <div class="post-meta"> + <span class="post-time"> + {% if config.extra.seje_chinese_date %} + {{ macros::format_chinese_date(year=section.extra.year, month=section.extra.month, day=section.extra.day) }} + {% else %} + {{ section.extra.date|date(format="%Y/%m/%d") }} + {% endif %} + </span> + </div> +</article> + +<div class="prev_next"> +<nav id="prev_next"> + <div class="prev"> + {% if section.later %} + <p>Newer</p><a href="{{ section.later.permalink }}"><div class="article-nav-title">{{ section.later.title }}</div></a> + {% endif %} + </div> + <div class="next"> + {% if section.earlier %} + <p>Older</p><a href="{{ section.earlier.permalink }}"><div class="article-nav-title">{{ section.earlier.title }}</div></a> + {% endif %} + </div> +</nav> +</div> + +<div class="post-comment"> +{# Discussion #} +</div> +{% endblock %} diff --git a/templates/shortcodes/shikwasa.html b/templates/shortcodes/shikwasa.html new file mode 100644 index 0000000..d29238d --- /dev/null +++ b/templates/shortcodes/shikwasa.html @@ -0,0 +1,16 @@ +<div class="podcast"> + <script> + const player = new Shikwasa({ + container: () => document.querySelector('.podcast'), + audio: { + title: '{{subtitle}}', + artist: '{{author}}', + cover: '{{image}}', + src: '{{media}}', + }, + fixed: { + type: 'static', + }, + }); + </script> +</div> |