From 7c030dc9406eed9db7c27bfac6f350fef0eb8eff Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:44:21 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E4=BC=98=E5=85=88=E4=BD=BF=E7=94=A8=20`p?= =?UTF-8?q?age.locale`=20=E8=AE=BE=E7=BD=AE=20UI=20=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _includes/after-content.html | 0 _includes/analytics-providers/custom.html | 3 + .../analytics-providers/google-gtag.html | 9 + .../analytics-providers/google-universal.html | 7 + _includes/analytics-providers/google.html | 14 + _includes/analytics.html | 14 + _includes/archive-single.html | 30 +++ _includes/author-profile-custom-links.html | 7 + _includes/author-profile.html | 247 ++++++++++++++++++ _includes/before-related.html | 0 _includes/breadcrumbs.html | 41 +++ _includes/category-list.html | 20 ++ _includes/comment.html | 22 ++ _includes/comments-providers/custom.html | 3 + .../comments-providers/custom_scripts.html | 3 + _includes/comments-providers/discourse.html | 13 + _includes/comments-providers/disqus.html | 15 ++ _includes/comments-providers/facebook.html | 8 + _includes/comments-providers/giscus.html | 34 +++ _includes/comments-providers/scripts.html | 20 ++ _includes/comments-providers/staticman.html | 41 +++ .../comments-providers/staticman_v2.html | 41 +++ _includes/comments-providers/utterances.html | 21 ++ _includes/comments.html | 181 +++++++++++++ _includes/copyright.html | 6 + _includes/copyright.js | 6 + _includes/documents-collection.html | 13 + _includes/feature_row | 42 +++ _includes/figure | 11 + _includes/footer.html | 27 ++ _includes/footer/custom.html | 3 + _includes/gallery | 35 +++ _includes/group-by-array | 47 ++++ _includes/masthead.html | 40 +++ _includes/nav_list | 28 ++ _includes/page__date.html | 7 + _includes/page__hero.html | 54 ++++ _includes/page__hero_video.html | 2 + _includes/page__meta.html | 32 +++ _includes/page__related.html | 12 + _includes/page__taxonomy.html | 7 + _includes/paginator-v1.html | 71 +++++ _includes/paginator-v2.html | 69 +++++ _includes/paginator.html | 7 + _includes/post_pagination.html | 15 ++ _includes/posts-category.html | 4 + _includes/posts-tag.html | 4 + _includes/posts-taxonomy.html | 38 +++ _includes/schema.html | 16 ++ _includes/scripts.html | 29 ++ _includes/search/algolia-search-scripts.html | 83 ++++++ _includes/search/google-search-scripts.html | 30 +++ _includes/search/lunr-search-scripts.html | 11 + _includes/search/search_form.html | 27 ++ _includes/seo.html | 135 ++++++++++ _includes/sidebar.html | 19 ++ _includes/skip-links.html | 8 + _includes/social-share.html | 20 ++ _includes/tag-list.html | 20 ++ _includes/toc | 8 + _includes/toc.html | 189 ++++++++++++++ _includes/video | 24 ++ _layouts/archive-taxonomy.html | 29 ++ _layouts/archive.html | 26 ++ _layouts/categories.html | 7 + _layouts/category.html | 10 + _layouts/collection.html | 10 + _layouts/compress.html | 10 + _layouts/default.html | 83 +++--- _layouts/posts.html | 31 +++ _layouts/search.html | 43 +++ _layouts/single.html | 88 +++++++ _layouts/splash.html | 22 ++ _layouts/tag.html | 10 + _layouts/tags.html | 7 + 75 files changed, 2328 insertions(+), 41 deletions(-) create mode 100644 _includes/after-content.html create mode 100644 _includes/analytics-providers/custom.html create mode 100644 _includes/analytics-providers/google-gtag.html create mode 100644 _includes/analytics-providers/google-universal.html create mode 100644 _includes/analytics-providers/google.html create mode 100644 _includes/analytics.html create mode 100644 _includes/archive-single.html create mode 100644 _includes/author-profile-custom-links.html create mode 100644 _includes/author-profile.html create mode 100644 _includes/before-related.html create mode 100644 _includes/breadcrumbs.html create mode 100644 _includes/category-list.html create mode 100644 _includes/comment.html create mode 100644 _includes/comments-providers/custom.html create mode 100644 _includes/comments-providers/custom_scripts.html create mode 100644 _includes/comments-providers/discourse.html create mode 100644 _includes/comments-providers/disqus.html create mode 100644 _includes/comments-providers/facebook.html create mode 100644 _includes/comments-providers/giscus.html create mode 100644 _includes/comments-providers/scripts.html create mode 100644 _includes/comments-providers/staticman.html create mode 100644 _includes/comments-providers/staticman_v2.html create mode 100644 _includes/comments-providers/utterances.html create mode 100644 _includes/comments.html create mode 100644 _includes/copyright.html create mode 100644 _includes/copyright.js create mode 100644 _includes/documents-collection.html create mode 100644 _includes/feature_row create mode 100644 _includes/figure create mode 100644 _includes/footer.html create mode 100644 _includes/footer/custom.html create mode 100644 _includes/gallery create mode 100644 _includes/group-by-array create mode 100644 _includes/masthead.html create mode 100644 _includes/nav_list create mode 100644 _includes/page__date.html create mode 100644 _includes/page__hero.html create mode 100644 _includes/page__hero_video.html create mode 100644 _includes/page__meta.html create mode 100644 _includes/page__related.html create mode 100644 _includes/page__taxonomy.html create mode 100644 _includes/paginator-v1.html create mode 100644 _includes/paginator-v2.html create mode 100644 _includes/paginator.html create mode 100644 _includes/post_pagination.html create mode 100644 _includes/posts-category.html create mode 100644 _includes/posts-tag.html create mode 100644 _includes/posts-taxonomy.html create mode 100644 _includes/schema.html create mode 100644 _includes/scripts.html create mode 100644 _includes/search/algolia-search-scripts.html create mode 100644 _includes/search/google-search-scripts.html create mode 100644 _includes/search/lunr-search-scripts.html create mode 100644 _includes/search/search_form.html create mode 100644 _includes/seo.html create mode 100644 _includes/sidebar.html create mode 100644 _includes/skip-links.html create mode 100644 _includes/social-share.html create mode 100644 _includes/tag-list.html create mode 100644 _includes/toc create mode 100644 _includes/toc.html create mode 100644 _includes/video create mode 100644 _layouts/archive-taxonomy.html create mode 100644 _layouts/archive.html create mode 100644 _layouts/categories.html create mode 100644 _layouts/category.html create mode 100644 _layouts/collection.html create mode 100644 _layouts/compress.html create mode 100644 _layouts/posts.html create mode 100644 _layouts/search.html create mode 100644 _layouts/single.html create mode 100644 _layouts/splash.html create mode 100644 _layouts/tag.html create mode 100644 _layouts/tags.html diff --git a/_includes/after-content.html b/_includes/after-content.html new file mode 100644 index 00000000..e69de29b diff --git a/_includes/analytics-providers/custom.html b/_includes/analytics-providers/custom.html new file mode 100644 index 00000000..c34b97ad --- /dev/null +++ b/_includes/analytics-providers/custom.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/analytics-providers/google-gtag.html b/_includes/analytics-providers/google-gtag.html new file mode 100644 index 00000000..16d0cf17 --- /dev/null +++ b/_includes/analytics-providers/google-gtag.html @@ -0,0 +1,9 @@ + + + diff --git a/_includes/analytics-providers/google-universal.html b/_includes/analytics-providers/google-universal.html new file mode 100644 index 00000000..68c2674b --- /dev/null +++ b/_includes/analytics-providers/google-universal.html @@ -0,0 +1,7 @@ + + diff --git a/_includes/analytics-providers/google.html b/_includes/analytics-providers/google.html new file mode 100644 index 00000000..c5742b98 --- /dev/null +++ b/_includes/analytics-providers/google.html @@ -0,0 +1,14 @@ + diff --git a/_includes/analytics.html b/_includes/analytics.html new file mode 100644 index 00000000..371469f0 --- /dev/null +++ b/_includes/analytics.html @@ -0,0 +1,14 @@ +{% if jekyll.environment == 'production' and site.analytics.provider and page.analytics != false %} + +{% case site.analytics.provider %} +{% when "google" %} + {% include /analytics-providers/google.html %} +{% when "google-universal" %} + {% include /analytics-providers/google-universal.html %} +{% when "google-gtag" %} + {% include /analytics-providers/google-gtag.html %} +{% when "custom" %} + {% include /analytics-providers/custom.html %} +{% endcase %} + +{% endif %} \ No newline at end of file diff --git a/_includes/archive-single.html b/_includes/archive-single.html new file mode 100644 index 00000000..7854c961 --- /dev/null +++ b/_includes/archive-single.html @@ -0,0 +1,30 @@ +{% if post.header.teaser %} + {% capture teaser %}{{ post.header.teaser }}{% endcapture %} +{% else %} + {% assign teaser = site.teaser %} +{% endif %} + +{% if post.id %} + {% assign title = post.title | markdownify | remove: "

" | remove: "

" %} +{% else %} + {% assign title = post.title %} +{% endif %} + +
+
+ {% if include.type == "grid" and teaser %} +
+ +
+ {% endif %} +

+ {% if post.link %} + {{ title }} Permalink + {% else %} + {{ title }} + {% endif %} +

+ {% include page__meta.html type=include.type %} + {% if post.excerpt %}

{{ post.excerpt | markdownify | strip_html | truncate: 160 }}

{% endif %} +
+
diff --git a/_includes/author-profile-custom-links.html b/_includes/author-profile-custom-links.html new file mode 100644 index 00000000..1a3d4cae --- /dev/null +++ b/_includes/author-profile-custom-links.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/_includes/author-profile.html b/_includes/author-profile.html new file mode 100644 index 00000000..cbd3d6ee --- /dev/null +++ b/_includes/author-profile.html @@ -0,0 +1,247 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign author = page.author | default: page.authors[0] | default: site.author %} +{% assign author = site.data.authors[author] | default: author %} + +
+ + {% if author.avatar %} +
+ + {{ author.name }} + +
+ {% endif %} + +
+

+ +

+ {% if author.bio %} +
+ {{ author.bio | markdownify }} +
+ {% endif %} +
+ +
+ + +
+
diff --git a/_includes/before-related.html b/_includes/before-related.html new file mode 100644 index 00000000..e69de29b diff --git a/_includes/breadcrumbs.html b/_includes/breadcrumbs.html new file mode 100644 index 00000000..47f61064 --- /dev/null +++ b/_includes/breadcrumbs.html @@ -0,0 +1,41 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% case site.category_archive.type %} + {% when "liquid" %} + {% assign path_type = "#" %} + {% when "jekyll-archives" %} + {% assign path_type = nil %} +{% endcase %} + +{% if page.collection != 'posts' %} + {% assign path_type = nil %} + {% assign crumb_path = '/' %} +{% else %} + {% assign crumb_path = site.category_archive.path %} +{% endif %} + + diff --git a/_includes/category-list.html b/_includes/category-list.html new file mode 100644 index 00000000..7eecbb8d --- /dev/null +++ b/_includes/category-list.html @@ -0,0 +1,20 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% case site.category_archive.type %} + {% when "liquid" %} + {% assign path_type = "#" %} + {% when "jekyll-archives" %} + {% assign path_type = nil %} +{% endcase %} + +{% if site.category_archive.path %} + {% assign categories_sorted = page.categories | sort_natural %} + +

+ {{ site.data.ui-text[locale].categories_label | default: "Categories:" }} + + {% for category_word in categories_sorted %} + {% unless forloop.last %}, {% endunless %} + {% endfor %} + +

+{% endif %} diff --git a/_includes/comment.html b/_includes/comment.html new file mode 100644 index 00000000..2e3013ee --- /dev/null +++ b/_includes/comment.html @@ -0,0 +1,22 @@ +
+
+ {{ include.name }} +
+
+ +

+ {% if include.date %} + {% if include.index %}{% endif %} + {% endif %} +

+
{{ include.message | markdownify }}
+
+
diff --git a/_includes/comments-providers/custom.html b/_includes/comments-providers/custom.html new file mode 100644 index 00000000..90993691 --- /dev/null +++ b/_includes/comments-providers/custom.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/comments-providers/custom_scripts.html b/_includes/comments-providers/custom_scripts.html new file mode 100644 index 00000000..6947946a --- /dev/null +++ b/_includes/comments-providers/custom_scripts.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/comments-providers/discourse.html b/_includes/comments-providers/discourse.html new file mode 100644 index 00000000..aca62cc8 --- /dev/null +++ b/_includes/comments-providers/discourse.html @@ -0,0 +1,13 @@ +{% if site.comments.discourse.server %} +{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url | absolute_url }}{% else %}{{ page.url | absolute_url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %} + + +{% endif %} diff --git a/_includes/comments-providers/disqus.html b/_includes/comments-providers/disqus.html new file mode 100644 index 00000000..16a6027c --- /dev/null +++ b/_includes/comments-providers/disqus.html @@ -0,0 +1,15 @@ +{% if site.comments.disqus.shortname %} + + +{% endif %} diff --git a/_includes/comments-providers/facebook.html b/_includes/comments-providers/facebook.html new file mode 100644 index 00000000..009dc1c6 --- /dev/null +++ b/_includes/comments-providers/facebook.html @@ -0,0 +1,8 @@ +
+ \ No newline at end of file diff --git a/_includes/comments-providers/giscus.html b/_includes/comments-providers/giscus.html new file mode 100644 index 00000000..a4f6365a --- /dev/null +++ b/_includes/comments-providers/giscus.html @@ -0,0 +1,34 @@ + diff --git a/_includes/comments-providers/scripts.html b/_includes/comments-providers/scripts.html new file mode 100644 index 00000000..e87badab --- /dev/null +++ b/_includes/comments-providers/scripts.html @@ -0,0 +1,20 @@ +{% if site.comments.provider and page.comments %} +{% case site.comments.provider %} + {% when "disqus" %} + {% include /comments-providers/disqus.html %} + {% when "discourse" %} + {% include /comments-providers/discourse.html %} + {% when "facebook" %} + {% include /comments-providers/facebook.html %} + {% when "staticman" %} + {% include /comments-providers/staticman.html %} + {% when "staticman_v2" %} + {% include /comments-providers/staticman_v2.html %} + {% when "utterances" %} + {% include /comments-providers/utterances.html %} + {% when "giscus" %} + {% include /comments-providers/giscus.html %} + {% when "custom" %} + {% include /comments-providers/custom_scripts.html %} +{% endcase %} +{% endif %} \ No newline at end of file diff --git a/_includes/comments-providers/staticman.html b/_includes/comments-providers/staticman.html new file mode 100644 index 00000000..8951ed59 --- /dev/null +++ b/_includes/comments-providers/staticman.html @@ -0,0 +1,41 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if site.repository and site.staticman.branch %} + +{% endif %} diff --git a/_includes/comments-providers/staticman_v2.html b/_includes/comments-providers/staticman_v2.html new file mode 100644 index 00000000..1c534d36 --- /dev/null +++ b/_includes/comments-providers/staticman_v2.html @@ -0,0 +1,41 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if site.repository and site.comments.staticman.branch %} + +{% endif %} diff --git a/_includes/comments-providers/utterances.html b/_includes/comments-providers/utterances.html new file mode 100644 index 00000000..5cf6c5cc --- /dev/null +++ b/_includes/comments-providers/utterances.html @@ -0,0 +1,21 @@ + diff --git a/_includes/comments.html b/_includes/comments.html new file mode 100644 index 00000000..ca1aa70c --- /dev/null +++ b/_includes/comments.html @@ -0,0 +1,181 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +
+ {% capture comments_label %}{{ site.data.ui-text[locale].comments_label | default: "Comments" }}{% endcapture %} + {% case site.comments.provider %} + {% when "discourse" %} +

{{ comments_label }}

+
+ {% when "disqus" %} +

{{ comments_label }}

+
+ {% when "facebook" %} +

{{ comments_label }}

+
+ {% when "staticman_v2" %} +
+ {% if site.repository and site.comments.staticman.branch %} + +
+ {% if site.data.comments[page.slug] %} +

{{ site.data.ui-text[locale].comments_title | default: "Comments" }}

+ {% assign comments = site.data.comments[page.slug] %} + + + {% assign commentObjects = '' | split: '' %} + {% for comment in comments %} + {% assign commentObject = comment[1] %} + {% assign commentObjects = commentObjects | push: commentObject %} + {% endfor %} + {% assign comments = commentObjects | sort: "date" %} + + {% for comment in comments %} + {% assign email = comment.email %} + {% assign name = comment.name %} + {% assign url = comment.url %} + {% assign date = comment.date %} + {% assign message = comment.message %} + {% include comment.html index=forloop.index email=email name=name url=url date=date message=message %} + {% endfor %} + {% endif %} +
+ + + +
+

{{ site.data.ui-text[locale].comments_label | default: "Leave a Comment" }}

+

{{ site.data.ui-text[locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} *

+
+
+ + {{ site.data.ui-text[locale].loading_label | default: "Loading..." }} +
+ +
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ + + + + {% if site.reCaptcha.siteKey %} +
+
+
+ {% endif %} +
+ +
+
+
+ + {% if site.reCaptcha.siteKey %}{% endif %} + {% endif %} +
+ {% when "staticman" %} +
+ {% if site.repository and site.staticman.branch %} + +
+ {% if site.data.comments[page.slug] %} +

{{ site.data.ui-text[locale].comments_title | default: "Comments" }}

+ {% assign comments = site.data.comments[page.slug] %} + + + {% assign commentObjects = '' | split: '' %} + {% for comment in comments %} + {% assign commentObject = comment[1] %} + {% assign commentObjects = commentObjects | push: commentObject %} + {% endfor %} + {% assign comments = commentObjects | sort: "date" %} + + {% for comment in comments %} + {% assign email = comment.email %} + {% assign name = comment.name %} + {% assign url = comment.url %} + {% assign date = comment.date %} + {% assign message = comment.message %} + {% include comment.html index=forloop.index email=email name=name url=url date=date message=message %} + {% endfor %} + {% endif %} +
+ + + +
+

{{ site.data.ui-text[locale].comments_label | default: "Leave a Comment" }}

+

{{ site.data.ui-text[locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} *

+
+
+ + {{ site.data.ui-text[locale].loading_label | default: "Loading..." }} +
+ +
+ + + +
+
+ + +
+
+ + +
+
+ + +
+ + + + +
+ +
+
+
+ + {% endif %} +
+ {% when "utterances" %} +

{{ comments_label }}

+
+ {% when "giscus" %} +

{{ comments_label }}

+
+ {% when "custom" %} + {% include /comments-providers/custom.html %} + {% endcase %} +
diff --git a/_includes/copyright.html b/_includes/copyright.html new file mode 100644 index 00000000..c50d1049 --- /dev/null +++ b/_includes/copyright.html @@ -0,0 +1,6 @@ + diff --git a/_includes/copyright.js b/_includes/copyright.js new file mode 100644 index 00000000..64765120 --- /dev/null +++ b/_includes/copyright.js @@ -0,0 +1,6 @@ +/*! + * Minimal Mistakes Jekyll Theme 4.27.3 by Michael Rose + * Copyright 2013-2025 Michael Rose - mademistakes.com | @mmistakes + * Free for personal and commercial use under the MIT license + * https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE + */ diff --git a/_includes/documents-collection.html b/_includes/documents-collection.html new file mode 100644 index 00000000..8c1d1279 --- /dev/null +++ b/_includes/documents-collection.html @@ -0,0 +1,13 @@ +{% assign entries = include.entries | default: site[include.collection] | where_exp: "post", "post.hidden != true" %} + +{% if include.sort_by %} + {% assign entries = entries | sort: include.sort_by %} +{% endif %} + +{% if include.sort_order == 'reverse' %} + {% assign entries = entries | reverse %} +{% endif %} + +{%- for post in entries -%} + {% include archive-single.html type=include.type %} +{%- endfor -%} diff --git a/_includes/feature_row b/_includes/feature_row new file mode 100644 index 00000000..56163d30 --- /dev/null +++ b/_includes/feature_row @@ -0,0 +1,42 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if include.id %} + {% assign feature_row = page[include.id] %} +{% else %} + {% assign feature_row = page.feature_row %} +{% endif %} + +
+ + {% for f in feature_row %} +
+
+ {% if f.image_path %} +
+ {% if f.alt %}{{ f.alt }}{% endif %} + {% if f.image_caption %} + {{ f.image_caption | markdownify | remove: "

" | remove: "

" }}
+ {% endif %} +
+ {% endif %} + +
+ {% if f.title %} +

{{ f.title }}

+ {% endif %} + + {% if f.excerpt %} +
+ {{ f.excerpt | markdownify }} +
+ {% endif %} + + {% if f.url %} +

{{ f.btn_label | default: site.data.ui-text[locale].more_label | default: "Learn More" }}

+ {% endif %} +
+
+
+ {% endfor %} + +
diff --git a/_includes/figure b/_includes/figure new file mode 100644 index 00000000..62a07b11 --- /dev/null +++ b/_includes/figure @@ -0,0 +1,11 @@ +
+ {%- if include.popup -%}{%- endif -%} + {% if include.alt %}{{ include.alt | escape_once }}{% endif %} + {%- if include.popup -%}{%- endif -%} + {%- if include.caption -%} +
+ {{ include.caption | markdownify | remove: "

" | remove: "

" }} +
+ {%- endif -%} +
diff --git a/_includes/footer.html b/_includes/footer.html new file mode 100644 index 00000000..10ee0233 --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,27 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% unless site.atom_feed.hide %} + {% assign show_atom = true %} +{% endunless %} +{% if site.footer.links or show_atom %} + +{% endif %} + + diff --git a/_includes/footer/custom.html b/_includes/footer/custom.html new file mode 100644 index 00000000..d512599d --- /dev/null +++ b/_includes/footer/custom.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/_includes/gallery b/_includes/gallery new file mode 100644 index 00000000..0b5892f0 --- /dev/null +++ b/_includes/gallery @@ -0,0 +1,35 @@ +{% if include.id %} + {% assign gallery = page[include.id] %} +{% else %} + {% assign gallery = page.gallery %} +{% endif %} + +{% if include.layout %} + {% assign gallery_layout = include.layout %} +{% else %} + {% if gallery.size == 2 %} + {% assign gallery_layout = 'half' %} + {% elsif gallery.size >= 3 %} + {% assign gallery_layout = 'third' %} + {% else %} + {% assign gallery_layout = '' %} + {% endif %} +{% endif %} + + diff --git a/_includes/group-by-array b/_includes/group-by-array new file mode 100644 index 00000000..708de41a --- /dev/null +++ b/_includes/group-by-array @@ -0,0 +1,47 @@ + + + +{% assign __empty_array = '' | split: ',' %} +{% assign group_names = __empty_array %} +{% assign group_items = __empty_array %} + + +{% assign __names = include.collection | map: include.field %} + + +{% assign __names = __names | join: ',' | join: ',' | split: ',' %} + + +{% assign __names = __names | sort %} +{% for name in __names %} + + +{% unless name == previous %} + + +{% assign group_names = group_names | push: name %} +{% endunless %} + +{% assign previous = name %} +{% endfor %} + + + +{% for name in group_names %} + + +{% assign __item = __empty_array %} +{% for __element in include.collection %} +{% if __element[include.field] contains name %} +{% assign __item = __item | push: __element %} +{% endif %} +{% endfor %} + + +{% assign group_items = group_items | push: __item %} +{% endfor %} \ No newline at end of file diff --git a/_includes/masthead.html b/_includes/masthead.html new file mode 100644 index 00000000..85dc14e0 --- /dev/null +++ b/_includes/masthead.html @@ -0,0 +1,40 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% capture logo_path %}{{ site.logo }}{% endcapture %} + +
+
+
+ +
+
+
diff --git a/_includes/nav_list b/_includes/nav_list new file mode 100644 index 00000000..cbd9ce0e --- /dev/null +++ b/_includes/nav_list @@ -0,0 +1,28 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + diff --git a/_includes/page__date.html b/_includes/page__date.html new file mode 100644 index 00000000..5c92dbec --- /dev/null +++ b/_includes/page__date.html @@ -0,0 +1,7 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign date_format = site.date_format | default: "%B %-d, %Y" %} +{% if page.last_modified_at %} +

{{ site.data.ui-text[locale].date_label | default: "Updated:" }}

+{% elsif page.date %} +

{{ site.data.ui-text[locale].date_label | default: "Updated:" }}

+{% endif %} diff --git a/_includes/page__hero.html b/_includes/page__hero.html new file mode 100644 index 00000000..4e4b264f --- /dev/null +++ b/_includes/page__hero.html @@ -0,0 +1,54 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %} + +{% if page.header.overlay_filter contains "gradient" %} + {% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %} +{% elsif page.header.overlay_filter contains "rgba" %} + {% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %} + {% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %} +{% elsif page.header.overlay_filter %} + {% capture overlay_filter %}rgba(0, 0, 0, {{ page.header.overlay_filter }}){% endcapture %} + {% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %} +{% endif %} + +{% if page.header.image_description %} + {% assign image_description = page.header.image_description %} +{% else %} + {% assign image_description = page.title %} +{% endif %} + +{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %} + +
+ {% if page.header.overlay_color or page.header.overlay_image %} +
+

+ {% if paginator and site.paginate_show_page_num %} + {{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[locale].page | default: "Page" }} {{ paginator.page }}{% endunless %} + {% else %} + {{ page.title | default: site.title | markdownify | remove: "

" | remove: "

" }} + {% endif %} +

+ {% if page.tagline %} +

{{ page.tagline | markdownify | remove: "

" | remove: "

" }}

+ {% elsif page.header.show_overlay_excerpt != false and page.excerpt %} +

{{ page.excerpt | markdownify | remove: "

" | remove: "

" }}

+ {% endif %} + {% include page__meta.html %} + {% if page.header.actions %} +

+ {% for action in page.header.actions %} + {{ action.label | default: site.data.ui-text[locale].more_label | default: "Learn More" }} + {% endfor %} +

+ {% endif %} +
+ {% else %} + {{ image_description }} + {% endif %} + {% if page.header.caption %} + {{ page.header.caption | markdownify | remove: "

" | remove: "

" }}
+ {% endif %} +
diff --git a/_includes/page__hero_video.html b/_includes/page__hero_video.html new file mode 100644 index 00000000..a313a23d --- /dev/null +++ b/_includes/page__hero_video.html @@ -0,0 +1,2 @@ +{% assign video = page.header.video %} +{% include video id=video.id provider=video.provider danmaku=video.danmaku %} diff --git a/_includes/page__meta.html b/_includes/page__meta.html new file mode 100644 index 00000000..aba22393 --- /dev/null +++ b/_includes/page__meta.html @@ -0,0 +1,32 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign document = post | default: page %} +{% if document.read_time or document.show_date %} +

+ {% if document.show_date and document.date %} + {% assign date = document.date %} + + + {% assign date_format = site.date_format | default: "%B %-d, %Y" %} + + + {% endif %} + + {% if document.read_time and document.show_date %}{% endif %} + + {% if document.read_time %} + {% assign words_per_minute = document.words_per_minute | default: site.words_per_minute | default: 200 %} + {% assign words = document.content | strip_html | number_of_words %} + + + + {% if words < words_per_minute %} + {{ site.data.ui-text[locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[locale].minute_read | default: "minute read" }} + {% elsif words == words_per_minute %} + 1 {{ site.data.ui-text[locale].minute_read | default: "minute read" }} + {% else %} + {{ words | divided_by: words_per_minute }} {{ site.data.ui-text[locale].minute_read | default: "minute read" }} + {% endif %} + + {% endif %} +

+{% endif %} diff --git a/_includes/page__related.html b/_includes/page__related.html new file mode 100644 index 00000000..41b6a114 --- /dev/null +++ b/_includes/page__related.html @@ -0,0 +1,12 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign posts = include.posts | where_exp: "post", "post.hidden != true" %} + diff --git a/_includes/page__taxonomy.html b/_includes/page__taxonomy.html new file mode 100644 index 00000000..75c76c81 --- /dev/null +++ b/_includes/page__taxonomy.html @@ -0,0 +1,7 @@ +{% if site.tag_archive.type and page.tags[0] %} + {% include tag-list.html %} +{% endif %} + +{% if site.category_archive.type and page.categories[0] %} + {% include category-list.html %} +{% endif %} \ No newline at end of file diff --git a/_includes/paginator-v1.html b/_includes/paginator-v1.html new file mode 100644 index 00000000..86ee890c --- /dev/null +++ b/_includes/paginator-v1.html @@ -0,0 +1,71 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if paginator.total_pages > 1 %} + +{% endif %} diff --git a/_includes/paginator-v2.html b/_includes/paginator-v2.html new file mode 100644 index 00000000..6bad5dd6 --- /dev/null +++ b/_includes/paginator-v2.html @@ -0,0 +1,69 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + diff --git a/_includes/paginator.html b/_includes/paginator.html new file mode 100644 index 00000000..c4ab29ed --- /dev/null +++ b/_includes/paginator.html @@ -0,0 +1,7 @@ +{% if paginator.total_pages > 1 %} + {% if site.paginate %} + {% include paginator-v1.html %} + {% elsif site.pagination.enabled %} + {% include paginator-v2.html %} + {% endif %} +{% endif %} diff --git a/_includes/post_pagination.html b/_includes/post_pagination.html new file mode 100644 index 00000000..c397eed1 --- /dev/null +++ b/_includes/post_pagination.html @@ -0,0 +1,15 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if page.previous or page.next %} + +{% endif %} diff --git a/_includes/posts-category.html b/_includes/posts-category.html new file mode 100644 index 00000000..658f3151 --- /dev/null +++ b/_includes/posts-category.html @@ -0,0 +1,4 @@ +{% assign posts = site.categories[include.taxonomy] | where_exp: "post", "post.hidden != true" %} +{%- for post in posts -%} + {% include archive-single.html %} +{%- endfor -%} diff --git a/_includes/posts-tag.html b/_includes/posts-tag.html new file mode 100644 index 00000000..a8fc472b --- /dev/null +++ b/_includes/posts-tag.html @@ -0,0 +1,4 @@ +{% assign posts = site.tags[include.taxonomy] | where_exp: "post", "post.hidden != true" %} +{%- for post in posts -%} + {% include archive-single.html %} +{%- endfor -%} diff --git a/_includes/posts-taxonomy.html b/_includes/posts-taxonomy.html new file mode 100644 index 00000000..68e03f07 --- /dev/null +++ b/_includes/posts-taxonomy.html @@ -0,0 +1,38 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign items_max = 0 %} +{% for item in include.taxonomies %} + {% if item[1].size > items_max %} + {% assign items_max = item[1].size %} + {% endif %} +{% endfor %} + + + +{% assign entries_layout = page.entries_layout | default: 'list' %} +{% for i in (1..items_max) reversed %} + {% for taxonomy in include.taxonomies %} + {% if taxonomy[1].size == i %} +
+

{{ taxonomy[0] }}

+
+ {% for post in taxonomy.last %} + {% include archive-single.html type=entries_layout %} + {% endfor %} +
+ {{ site.data.ui-text[locale].back_to_top | default: 'Back to Top' }} ↑ +
+ {% endif %} + {% endfor %} +{% endfor %} diff --git a/_includes/schema.html b/_includes/schema.html new file mode 100644 index 00000000..1dae6e2d --- /dev/null +++ b/_includes/schema.html @@ -0,0 +1,16 @@ + diff --git a/_includes/scripts.html b/_includes/scripts.html new file mode 100644 index 00000000..882c3b98 --- /dev/null +++ b/_includes/scripts.html @@ -0,0 +1,29 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% if site.footer_scripts %} + {% for script in site.footer_scripts %} + + {% endfor %} +{% else %} + +{% endif %} + +{% if site.search == true or page.layout == "search" %} + {%- assign search_provider = site.search_provider | default: "lunr" -%} + {%- case search_provider -%} + {%- when "lunr" -%} + {% include_cached search/lunr-search-scripts.html locale=locale %} + {%- when "google" -%} + {% include_cached search/google-search-scripts.html %} + {%- when "algolia" -%} + {% include_cached search/algolia-search-scripts.html locale=locale %} + {%- endcase -%} +{% endif %} + +{% include analytics.html %} +{% include /comments-providers/scripts.html %} + +{% if site.after_footer_scripts %} + {% for script in site.after_footer_scripts %} + + {% endfor %} +{% endif %} diff --git a/_includes/search/algolia-search-scripts.html b/_includes/search/algolia-search-scripts.html new file mode 100644 index 00000000..cd21bf9d --- /dev/null +++ b/_includes/search/algolia-search-scripts.html @@ -0,0 +1,83 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + diff --git a/_includes/search/google-search-scripts.html b/_includes/search/google-search-scripts.html new file mode 100644 index 00000000..4af7423b --- /dev/null +++ b/_includes/search/google-search-scripts.html @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/_includes/search/lunr-search-scripts.html b/_includes/search/lunr-search-scripts.html new file mode 100644 index 00000000..e3730fd0 --- /dev/null +++ b/_includes/search/lunr-search-scripts.html @@ -0,0 +1,11 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% assign lang = locale | slice: 0,2 | default: "en" %} +{% case lang %} +{% when "gr" %} + {% assign lang = "gr" %} +{% else %} + {% assign lang = "en" %} +{% endcase %} + + + diff --git a/_includes/search/search_form.html b/_includes/search/search_form.html new file mode 100644 index 00000000..8f7f47e6 --- /dev/null +++ b/_includes/search/search_form.html @@ -0,0 +1,27 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +
+ {%- assign search_provider = site.search_provider | default: "lunr" -%} + {%- case search_provider -%} + {%- when "lunr" -%} + +
+ {%- when "google" -%} + +
+ +
+ {%- when "algolia" -%} + +
+ {%- endcase -%} +
diff --git a/_includes/seo.html b/_includes/seo.html new file mode 100644 index 00000000..71892c66 --- /dev/null +++ b/_includes/seo.html @@ -0,0 +1,135 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + +{%- assign title_separator = site.title_separator | default: '-' -%} + +{%- assign page_title = page.title | default: site.title | replace: '|', '|' -%} +{%- if page_title contains site.title -%} + {%- assign seo_title = page_title | replace: '|', '|' -%} +{%- else -%} + {%- assign seo_title = page_title | append: " " | append: title_separator | append: " " | append: site.title | replace: '|', '|' -%} +{%- endif -%} + +{%- assign page_title = page_title | markdownify | strip_html | strip_newlines | escape_once -%} +{%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%} + +{%- assign canonical_url = page.canonical_url | default: page.url | replace: "/index.html", "/" | absolute_url %} + +{%- assign seo_description = page.description | default: page.excerpt | default: site.description -%} +{%- if seo_description -%} + {%- assign seo_description = seo_description | markdownify | strip_html | newline_to_br | strip_newlines | replace: '
', ' ' | escape_once | strip -%} +{%- endif -%} + +{%- assign author = page.author | default: page.authors[0] | default: site.author -%} +{%- assign author = site.data.authors[author] | default: author -%} + +{%- if author.twitter -%} + {%- assign author_twitter = author.twitter | replace: "@", "" -%} +{%- endif -%} + +{%- assign page_large_image = page.header.og_image | default: page.header.overlay_image | default: page.header.image | absolute_url | escape -%} +{%- assign page_teaser_image = page.header.teaser | default: site.og_image | absolute_url | escape -%} +{%- assign site_og_image = site.og_image | absolute_url | escape -%} + +{%- if page.date -%} + {%- assign og_type = "article" -%} +{%- else -%} + {%- assign og_type = "website" -%} +{%- endif -%} + +{{ seo_title }}{% if paginator %}{% unless paginator.page == 1 %} {{ title_separator }} {{ site.data.ui-text[locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}{% endif %} + + +{% if author.name %} + + {% if og_type == "article" %} + + {% endif %} +{% endif %} + + + + + + + +{% if seo_description %} + +{% endif %} + +{% if page_large_image %} + +{% elsif page_teaser_image %} + +{% endif %} + +{% if site.twitter.username %} + + + + + + {% if page_large_image %} + + + {% else %} + + {% if page_teaser_image %} + + {% endif %} + {% endif %} + + {% if author_twitter %} + + {% endif %} +{% endif %} + +{% if page.date %} + +{% endif %} + +{% if og_type == "article" and page.last_modified_at %} + +{% endif %} + +{% if site.facebook %} + {% if site.facebook.publisher %} + + {% endif %} + + {% if site.facebook.app_id %} + + {% endif %} +{% endif %} + + + +{% if paginator.previous_page %} + +{% endif %} +{% if paginator.next_page %} + +{% endif %} + +{% if page.url == '/' %} + {% include schema.html %} +{% endif %} + +{% if site.google_site_verification %} + +{% endif %} +{% if site.bing_site_verification %} + +{% endif %} +{% if site.alexa_site_verification %} + +{% endif %} +{% if site.yandex_site_verification %} + +{% endif %} +{% if site.naver_site_verification %} + +{% endif %} +{% if site.baidu_site_verification %} + +{% endif %} + diff --git a/_includes/sidebar.html b/_includes/sidebar.html new file mode 100644 index 00000000..a4ca1ca7 --- /dev/null +++ b/_includes/sidebar.html @@ -0,0 +1,19 @@ +{% if page.author_profile or layout.author_profile or page.sidebar %} + +{% endif %} diff --git a/_includes/skip-links.html b/_includes/skip-links.html new file mode 100644 index 00000000..b72eba1e --- /dev/null +++ b/_includes/skip-links.html @@ -0,0 +1,8 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + diff --git a/_includes/social-share.html b/_includes/social-share.html new file mode 100644 index 00000000..5cb50b49 --- /dev/null +++ b/_includes/social-share.html @@ -0,0 +1,20 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +
+

{{ site.data.ui-text[locale].share_on_label | default: "Share on" }}

+ + + X + + + + Facebook + + + + LinkedIn + + + + Bluesky + +
diff --git a/_includes/tag-list.html b/_includes/tag-list.html new file mode 100644 index 00000000..f1427eba --- /dev/null +++ b/_includes/tag-list.html @@ -0,0 +1,20 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{% case site.tag_archive.type %} + {% when "liquid" %} + {% assign path_type = "#" %} + {% when "jekyll-archives" %} + {% assign path_type = nil %} +{% endcase %} + +{% if site.tag_archive.path %} + {% assign tags_sorted = page.tags | sort_natural %} + +

+ {{ site.data.ui-text[locale].tags_label | default: "Tags:" }} + + {% for tag_word in tags_sorted %} + {% unless forloop.last %}, {% endunless %} + {% endfor %} + +

+{% endif %} diff --git a/_includes/toc b/_includes/toc new file mode 100644 index 00000000..5734aa18 --- /dev/null +++ b/_includes/toc @@ -0,0 +1,8 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} + diff --git a/_includes/toc.html b/_includes/toc.html new file mode 100644 index 00000000..bc90d08a --- /dev/null +++ b/_includes/toc.html @@ -0,0 +1,189 @@ +{% capture tocWorkspace %} + {% comment %} + Copyright (c) 2017 Vladimir "allejo" Jimenez + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + {% endcomment %} + {% comment %} + Version 1.2.1 + https://github.com/allejo/jekyll-toc + + "...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe + + Usage: + {% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %} + + Parameters: + * html (string) - the HTML of compiled markdown generated by kramdown in Jekyll + + Optional Parameters: + * sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC + * class (string) : '' - a CSS class assigned to the TOC + * id (string) : '' - an ID to assigned to the TOC + * h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored + * h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored + * ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list + * item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level + * submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level + * base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content + * anchor_class (string) : '' - add custom class(es) for each anchor element + * skip_no_ids (bool) : false - skip headers that do not have an `id` attribute + * flat_toc (bool) : false - when set to true, the TOC will be a single level list + + Output: + An ordered or unordered list representing the table of contents of a markdown block. This snippet will only + generate the table of contents and will NOT output the markdown given to it + {% endcomment %} + + {% capture newline %} + {% endcapture %} + {% assign newline = newline | rstrip %} + + {% capture deprecation_warnings %}{% endcapture %} + + {% if include.baseurl %} + {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} + {% endif %} + + {% if include.skipNoIDs %} + {% capture deprecation_warnings %}{{ deprecation_warnings }}{{ newline }}{% endcapture %} + {% endif %} + + {% capture jekyll_toc %}{% endcapture %} + {% assign orderedList = include.ordered | default: false %} + {% assign flatToc = include.flat_toc | default: false %} + {% assign baseURL = include.base_url | default: include.baseurl | default: '' %} + {% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %} + {% assign minHeader = include.h_min | default: 1 %} + {% assign maxHeader = include.h_max | default: 6 %} + {% assign nodes = include.html | strip | split: ' maxHeader %} + {% continue %} + {% endif %} + + {% assign _workspace = node | split: '' | first }}>{% endcapture %} + {% assign header = _workspace[0] | replace: _hAttrToStrip, '' %} + + {% if include.item_class and include.item_class != blank %} + {% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %} + {% endif %} + + {% if include.submenu_class and include.submenu_class != blank %} + {% assign subMenuLevel = currLevel | minus: 1 %} + {% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %} + {% endif %} + + {% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %} + + {% if htmlID %} + {% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %} + + {% if include.anchor_class %} + {% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %} + {% endif %} + + {% capture listItem %}{{ anchorBody }}{% endcapture %} + {% elsif skipNoIDs == true %} + {% continue %} + {% else %} + {% capture listItem %}{{ anchorBody }}{% endcapture %} + {% endif %} + + {% if currLevel > lastLevel and flatToc == false %} + {% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %} + {% elsif currLevel < lastLevel and flatToc == false %} + {% assign repeatCount = lastLevel | minus: currLevel %} + + {% for i in (1..repeatCount) %} + {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} + {% endfor %} + + {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} + {% else %} + {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} + {% endif %} + + {% capture jekyll_toc %}{{ jekyll_toc }}{{ listItem }}{% endcapture %} + + {% assign lastLevel = currLevel %} + {% assign firstHeader = false %} + {% endfor %} + + {% if flatToc == true %} + {% assign repeatCount = 1 %} + {% else %} + {% assign repeatCount = minHeader | minus: 1 %} + {% assign repeatCount = lastLevel | minus: repeatCount %} + {% endif %} + + {% for i in (1..repeatCount) %} + {% capture jekyll_toc %}{{ jekyll_toc }}{% endcapture %} + {% endfor %} + + {% if jekyll_toc != '' %} + {% assign rootAttributes = '' %} + {% if include.class and include.class != blank %} + {% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %} + {% endif %} + + {% if include.id and include.id != blank %} + {% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %} + {% endif %} + + {% if rootAttributes %} + {% assign nodes = jekyll_toc | split: '>' %} + {% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %} + {% endif %} + {% endif %} +{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}} diff --git a/_includes/video b/_includes/video new file mode 100644 index 00000000..c85a868c --- /dev/null +++ b/_includes/video @@ -0,0 +1,24 @@ +{% capture video_id %}{{ include.id }}{% endcapture %} +{% capture video_provider %}{{ include.provider }}{% endcapture %} +{% capture video_danmaku %}{{ include.danmaku | default: 0 }}{% endcapture %} + +{% capture video_src %} + {% case video_provider %} + {% when "vimeo" %} + https://player.vimeo.com/video/{{ video_id }}?dnt=true + {% when "youtube" %} + https://www.youtube-nocookie.com/embed/{{ video_id }} + {% when "google-drive" %} + https://drive.google.com/file/d/{{ video_id }}/preview + {% when "bilibili" %} + https://player.bilibili.com/player.html?bvid={{ video_id }}&page=1&as_wide=1&high_quality=1&danmaku={{ video_danmaku }} + {% endcase %} +{% endcapture %} +{% assign video_src = video_src | strip %} + + +{% unless video_src == "" %} +
+ +
+{% endunless %} diff --git a/_layouts/archive-taxonomy.html b/_layouts/archive-taxonomy.html new file mode 100644 index 00000000..4e94867d --- /dev/null +++ b/_layouts/archive-taxonomy.html @@ -0,0 +1,29 @@ +--- +layout: default +author_profile: false +--- + +{% if page.header.overlay_color or page.header.overlay_image or page.header.image %} + {% include page__hero.html %} +{% elsif page.header.video.id and page.header.video.provider %} + {% include page__hero_video.html %} +{% endif %} + +{% if page.url != "/" and site.breadcrumbs %} + {% unless paginator %} + {% include breadcrumbs.html %} + {% endunless %} +{% endif %} + +
+ {% include sidebar.html %} + +
+ {% unless page.header.overlay_color or page.header.overlay_image %} +

{{ page.title }}

+ {% endunless %} + {% for post in page.posts %} + {% include archive-single.html %} + {% endfor %} +
+
diff --git a/_layouts/archive.html b/_layouts/archive.html new file mode 100644 index 00000000..83e109b5 --- /dev/null +++ b/_layouts/archive.html @@ -0,0 +1,26 @@ +--- +layout: default +--- + +{% if page.header.overlay_color or page.header.overlay_image or page.header.image %} + {% include page__hero.html %} +{% elsif page.header.video.id and page.header.video.provider %} + {% include page__hero_video.html %} +{% endif %} + +{% if page.url != "/" and site.breadcrumbs %} + {% unless paginator %} + {% include breadcrumbs.html %} + {% endunless %} +{% endif %} + +
+ {% include sidebar.html %} + +
+ {% unless page.header.overlay_color or page.header.overlay_image %} +

{{ page.title }}

+ {% endunless %} + {{ content }} +
+
diff --git a/_layouts/categories.html b/_layouts/categories.html new file mode 100644 index 00000000..4d366118 --- /dev/null +++ b/_layouts/categories.html @@ -0,0 +1,7 @@ +--- +layout: archive +--- + +{{ content }} + +{% include posts-taxonomy.html taxonomies=site.categories %} diff --git a/_layouts/category.html b/_layouts/category.html new file mode 100644 index 00000000..b281c856 --- /dev/null +++ b/_layouts/category.html @@ -0,0 +1,10 @@ +--- +layout: archive +--- + +{{ content }} + +{% assign entries_layout = page.entries_layout | default: 'list' %} +
+ {% include posts-category.html taxonomy=page.taxonomy type=entries_layout %} +
diff --git a/_layouts/collection.html b/_layouts/collection.html new file mode 100644 index 00000000..d23d0c72 --- /dev/null +++ b/_layouts/collection.html @@ -0,0 +1,10 @@ +--- +layout: archive +--- + +{{ content }} + +{% assign entries_layout = page.entries_layout | default: 'list' %} +
+ {% include documents-collection.html collection=page.collection sort_by=page.sort_by sort_order=page.sort_order type=entries_layout %} +
diff --git a/_layouts/compress.html b/_layouts/compress.html new file mode 100644 index 00000000..bb34487d --- /dev/null +++ b/_layouts/compress.html @@ -0,0 +1,10 @@ +--- +# Jekyll layout that compresses HTML +# v3.1.0 +# http://jch.penibelst.de/ +# © 2014–2015 Anatol Broder +# MIT License +--- + +{% capture _LINE_FEED %} +{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment or site.compress_html.ignore.envs == "all" %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "" %}{% endif %}{% unless _pre_before contains "" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " ;; ;" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %}
Step Bytes
raw {{ content | size }}{% if _profile_endings %}
endings {{ _profile_endings }}{% endif %}{% if _profile_startings %}
startings {{ _profile_startings }}{% endif %}{% if _profile_comments %}
comments {{ _profile_comments }}{% endif %}{% if _profile_collapse %}
collapse {{ _profile_collapse }}{% endif %}{% if _profile_clippings %}
clippings {{ _profile_clippings }}{% endif %}
{% endif %}{% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index e691d2a6..69a93c59 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,41 +1,42 @@ ---- -layout: compress ---- - - -{% include copyright.html %} - - - {% include head.html %} - {% include head/custom.html %} - - - - {% if site.preview and site.preview.pr-number %} -
当前站点为预览构建而非官方文档。如需反馈问题,请前往 #{{ site.preview.pr-number }} 留言。
- {% endif %} - - {% include_cached skip-links.html %} - {% include_cached masthead.html %} - -
- {{ content }} - {% include after-content.html %} -
- - {% if site.search == true %} -
- {% include_cached search/search_form.html %} -
- {% endif %} - - - - {% include scripts.html %} - - +--- +layout: compress +--- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} + + +{% include copyright.html %} + + + {% include head.html %} + {% include head/custom.html %} + + + + {% if site.preview and site.preview.pr-number %} +
当前站点为预览构建而非官方文档。如需反馈问题,请前往 #{{ site.preview.pr-number }} 留言。
+ {% endif %} + + {% include_cached skip-links.html locale=locale %} + {% include_cached masthead.html locale=locale %} + +
+ {{ content }} + {% include after-content.html %} +
+ + {% if site.search == true %} +
+ {% include_cached search/search_form.html locale=locale %} +
+ {% endif %} + + + + {% include scripts.html %} + + diff --git a/_layouts/posts.html b/_layouts/posts.html new file mode 100644 index 00000000..122de3fe --- /dev/null +++ b/_layouts/posts.html @@ -0,0 +1,31 @@ +--- +layout: archive +--- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} + +{{ content }} + +
    + {% assign postsInYear = site.posts | where_exp: "item", "item.hidden != true" | group_by_exp: 'post', 'post.date | date: "%Y"' %} + {% for year in postsInYear %} +
  • + + {{ year.name }} {{ year.items | size }} + +
  • + {% endfor %} +
+ +{% assign entries_layout = page.entries_layout | default: 'list' %} +{% assign postsByYear = site.posts | where_exp: "item", "item.hidden != true" | group_by_exp: 'post', 'post.date | date: "%Y"' %} +{% for year in postsByYear %} +
+

{{ year.name }}

+
+ {% for post in year.items %} + {% include archive-single.html type=entries_layout %} + {% endfor %} +
+ {{ site.data.ui-text[locale].back_to_top | default: 'Back to Top' }} ↑ +
+{% endfor %} diff --git a/_layouts/search.html b/_layouts/search.html new file mode 100644 index 00000000..c031655e --- /dev/null +++ b/_layouts/search.html @@ -0,0 +1,43 @@ +--- +layout: default +--- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} + +{% if page.header.overlay_color or page.header.overlay_image or page.header.image %} + {% include page__hero.html %} +{% endif %} + +{% if page.url != "/" and site.breadcrumbs %} + {% unless paginator %} + {% include breadcrumbs.html %} + {% endunless %} +{% endif %} + +
+ {% include sidebar.html %} + +
+ {% unless page.header.overlay_color or page.header.overlay_image %} +

{{ page.title }}

+ {% endunless %} + + {{ content }} + + {%- assign search_provider = site.search_provider | default: "lunr" -%} + {%- case search_provider -%} + {%- when "lunr" -%} + +
+ {%- when "google" -%} +
+ +
+
+ +
+ {%- when "algolia" -%} + +
+ {%- endcase -%} +
+
diff --git a/_layouts/single.html b/_layouts/single.html new file mode 100644 index 00000000..4aea319c --- /dev/null +++ b/_layouts/single.html @@ -0,0 +1,88 @@ +--- +layout: default +--- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} + +{% if page.header.overlay_color or page.header.overlay_image or page.header.image %} + {% include page__hero.html %} +{% elsif page.header.video.id and page.header.video.provider %} + {% include page__hero_video.html %} +{% endif %} + +{% assign breadcrumbs_enabled = site.breadcrumbs %} +{% if page.breadcrumbs != null %} + {% assign breadcrumbs_enabled = page.breadcrumbs %} +{% endif %} +{% if page.url != "/" and breadcrumbs_enabled %} + {% unless paginator %} + {% include breadcrumbs.html %} + {% endunless %} +{% endif %} + +
+ {% include sidebar.html %} + +
+ {% if page.title %}{% endif %} + {% if page.excerpt %}{% endif %} + {% if page.date %}{% endif %} + {% if page.last_modified_at %}{% endif %} + +
+ {% unless page.header.overlay_color or page.header.overlay_image %} +
+ {% if page.title -%} +

+ +

+ {%- endif %} + {% include page__meta.html %} +
+ {% endunless %} + +
+ {% if page.toc %} + + {% endif %} + {{ content }} + {% if page.link %}{% endif %} +
+ +
+ {% if site.data.ui-text[locale].meta_label %} +

{{ site.data.ui-text[locale].meta_label }}

+ {% endif %} + {% include page__taxonomy.html %} + {% include page__date.html %} +
+ + {% if page.share %}{% include social-share.html %}{% endif %} + + {% include post_pagination.html %} +
+ + {% if site.comments.provider and page.comments %} + {% if jekyll.environment == 'production' %} + {% include comments.html %} + {% else %} +

+ Comments are configured with provider: {{ site.comments.provider }}, + but are disabled in non-production environments. +

+ {% endif %} + {% endif %} +
+ + {% comment %}{% endcomment %} + {% if page.id and page.related and site.related_posts.size > 0 %} + {% include page__related.html posts=site.related_posts %} + {% comment %}{% endcomment %} + {% elsif page.id and page.related %} + {% include page__related.html posts=site.posts %} + {% endif %} +
diff --git a/_layouts/splash.html b/_layouts/splash.html new file mode 100644 index 00000000..394209d8 --- /dev/null +++ b/_layouts/splash.html @@ -0,0 +1,22 @@ +--- +layout: default +--- + +{% if page.header.overlay_color or page.header.overlay_image or page.header.image %} + {% include page__hero.html %} +{% elsif page.header.video.id and page.header.video.provider %} + {% include page__hero_video.html %} +{% endif %} + +
+
+ {% if page.title %}{% endif %} + {% if page.excerpt %}{% endif %} + {% if page.date %}{% endif %} + {% if page.last_modified_at %}{% endif %} + +
+ {{ content }} +
+
+
diff --git a/_layouts/tag.html b/_layouts/tag.html new file mode 100644 index 00000000..8b1c1885 --- /dev/null +++ b/_layouts/tag.html @@ -0,0 +1,10 @@ +--- +layout: archive +--- + +{{ content }} + +{% assign entries_layout = page.entries_layout | default: 'list' %} +
+ {% include posts-tag.html taxonomy=page.taxonomy type=entries_layout %} +
diff --git a/_layouts/tags.html b/_layouts/tags.html new file mode 100644 index 00000000..a28fa5d7 --- /dev/null +++ b/_layouts/tags.html @@ -0,0 +1,7 @@ +--- +layout: archive +--- + +{{ content }} + +{% include posts-taxonomy.html taxonomies=site.tags %} From 1938627f0e5186ead299e35a2aa96a5fccc098b8 Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:44:33 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-preview.yml | 16 ++-- _config.yml | 16 +++- _data/plugins/i18n/fallback.yml | 1 + _data/plugins/i18n/ui-text.en.yml | 36 +++++++++ _data/plugins/i18n/ui-text.yml | 36 +++++++++ _data/plugins/i18n/ui-text.zh-Hant.yml | 36 +++++++++ _data/ui-text.yml | 107 +++++++++++++++++++++++++ _includes/seo.html | 2 +- _layouts/default.html | 8 +- _layouts/document.html | 42 +++++++++- _plugins/i18n.rb | 101 +++++++++++++++++++++++ 11 files changed, 386 insertions(+), 15 deletions(-) create mode 100644 _data/plugins/i18n/fallback.yml create mode 100644 _data/plugins/i18n/ui-text.en.yml create mode 100644 _data/plugins/i18n/ui-text.yml create mode 100644 _data/plugins/i18n/ui-text.zh-Hant.yml create mode 100644 _data/ui-text.yml create mode 100644 _plugins/i18n.rb diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index dabeeb1c..ef5d6c47 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -232,12 +232,16 @@ jobs: cache-version: PR-${{ env.GITHUB_PR_NUMBER }} - name: Jekyll Build run: | - echo "url: https://${{ needs.preview-create-init.outputs.domain }}" > _action.yml - echo "baseurl: ${{ needs.preview-create-init.outputs.pathname }}/PR${{ env.GITHUB_PR_NUMBER }}" >> _action.yml - echo "source: ${{ github.workspace }}" >> _action.yml - echo "destination: /home/runner/site" >> _action.yml - echo "preview:" >> _action.yml - echo " pr-number: ${{ env.GITHUB_PR_NUMBER }}" >> _action.yml + cat > _action.yml << EOF + url: https://${{ needs.preview-create-init.outputs.domain }} + baseurl: ${{ needs.preview-create-init.outputs.pathname }}/PR${{ env.GITHUB_PR_NUMBER }} + source: ${{ github.workspace }} + destination: /home/runner/site + preview: + feedback: + name: "#${{ env.GITHUB_PR_NUMBER }}" + url: https://github.com/${{ github.repository }}/pull/${{ env.GITHUB_PR_NUMBER }} + EOF ${{ env.PREVIEW_WATCH }} || bundle install --jobs 4 bundle exec jekyll build --trace --config _config.yml,_action.yml - id: upload-site diff --git a/_config.yml b/_config.yml index 29138c90..47e62fde 100644 --- a/_config.yml +++ b/_config.yml @@ -114,6 +114,7 @@ defaults: toc: true toc_sticky: true excerpt: "" + i18n: true - scope: path: "" type: downloads @@ -129,6 +130,18 @@ defaults: type: changelogs values: channel: stable + - scope: + path: assets + values: + i18n: false + - scope: + path: 404.md + values: + i18n: false + - scope: + path: robots.txt + values: + i18n: false # liquid: # error_mode: warn @@ -152,7 +165,8 @@ defaults: theme: minimal-mistakes-jekyll # Site Settings -locale: zh +locale: zh-Hans +locales: [zh-Hans, zh-Hant, en] # rtl: title: HMCL 文档 # title_separator: - diff --git a/_data/plugins/i18n/fallback.yml b/_data/plugins/i18n/fallback.yml new file mode 100644 index 00000000..677a1bb1 --- /dev/null +++ b/_data/plugins/i18n/fallback.yml @@ -0,0 +1 @@ +zh-Hant: zh-Hans diff --git a/_data/plugins/i18n/ui-text.en.yml b/_data/plugins/i18n/ui-text.en.yml new file mode 100644 index 00000000..f383f09d --- /dev/null +++ b/_data/plugins/i18n/ui-text.en.yml @@ -0,0 +1,36 @@ +locale_warning: + before: "The current content was written in " + after: . + +locale: + en: English + zh-Hans: Simplified Chinese + zh-Hant: Traditional Chinese + +info: + byline: + author: + before: "The current content was created by " + after: "" + default: unattributed user + contributors: + before: " and edited by " + after: "" + i18n: + before: ", with" + after: "" + between: " and" + translations: + before: " translation versions available in " + after: "" + fallbacks: + before: " fallback versions available in " + after: "" + end: . + +preview: + before: The current site is a preview build rather than the official documentation + after: . + feedback: + before: ". You may submit feedback in " + after: "" diff --git a/_data/plugins/i18n/ui-text.yml b/_data/plugins/i18n/ui-text.yml new file mode 100644 index 00000000..3c686359 --- /dev/null +++ b/_data/plugins/i18n/ui-text.yml @@ -0,0 +1,36 @@ +locale_warning: + before: 当前内容使用 + after: 撰写。 + +locale: + en: 英语 + zh-Hans: 简体中文 + zh-Hant: 繁体中文 + +info: + byline: + author: + before: "当前内容由 " + after: " 创建" + default: 未署名用户 + contributors: + before: "由 " + after: " 编辑" + i18n: + before: "并提供" + after: "" + between: "與" + translations: + before: " " + after: " 翻译版本" + fallbacks: + before: " " + after: " 回退版本" + end: 。 + +preview: + before: 当前站点为预览构建而非官方文档 + after: 。 + feedback: + before: ",您可前往 " + after: " 反馈" diff --git a/_data/plugins/i18n/ui-text.zh-Hant.yml b/_data/plugins/i18n/ui-text.zh-Hant.yml new file mode 100644 index 00000000..5f1c8a55 --- /dev/null +++ b/_data/plugins/i18n/ui-text.zh-Hant.yml @@ -0,0 +1,36 @@ +locale_warning: + before: 當前內容使用 + after: 撰冩。 + +locale: + en: 英語 + zh-Hans: 簡體中文 + zh-Hant: 繁體中文 + +info: + byline: + author: + before: "當前內容由 " + after: " 創建" + default: 未署名用戶 + contributors: + before: "由 " + after: " 編輯" + i18n: + before: "並提供" + after: "" + between: "与" + translations: + before: " " + after: " 翻譯版本" + fallbacks: + before: " " + after: " 回退版本" + end: 。 + +preview: + before: 當前站點爲預覽構建而非官方文檔 + after: 。 + feedback: + before: ",您可前往 " + after: " 反饋" diff --git a/_data/ui-text.yml b/_data/ui-text.yml new file mode 100644 index 00000000..93888815 --- /dev/null +++ b/_data/ui-text.yml @@ -0,0 +1,107 @@ +zh-Hans: &DEFAULT_ZH_HANS + skip_links: "跳转链接" + skip_primary_nav: "转到主导航栏" + skip_content: "转到内容" + skip_footer: "转到底部" + page: "页面" + pagination_previous: "上一页" + pagination_next: "下一页" + breadcrumb_home_label: "首页" + breadcrumb_separator: "/" + menu_label: "切换菜单" + search_label: "切换搜索" + toc_label: "目录" + ext_link_label: "直接链接" + less_than: "少于" + minute_read: "分钟阅读" + share_on_label: "分享" + meta_label: + tags_label: "标签:" + categories_label: "分类:" + date_label: "更新时间:" + comments_label: "留下评论" + comments_title: "评论" + more_label: "了解更多" + related_label: "猜您还喜欢" + follow_label: "关注:" + feed_label: "Feed" + powered_by: "技术来自于" + website_label: "网站" + email_label: "电子邮箱" + recent_posts: "最新文章" + undefined_wpm: "_config.yml 配置中 words_per_minute 字段未定义" + comment_form_info: "您的电子邮箱地址并不会被展示。请填写标记为必须的字段。" + comment_form_comment_label: "评论" + comment_form_md_info: "支持 Markdown 语法。" + comment_form_name_label: "姓名" + comment_form_email_label: "电子邮箱" + comment_form_website_label: "网站(可选)" + comment_btn_submit: "提交评论" + comment_btn_submitted: "已提交" + comment_success_msg: "感谢您的评论!被批准后它会立即在此站点展示。" + comment_error_msg: "很抱歉,您的提交存在错误。请确保所有必填字段都已填写正确,然后再试一次。" + loading_label: "正在加载..." + search_label_text: "输入您要搜索的关键词..." + search_placeholder_text: "输入您要搜索的关键词..." + search_algolia_no_results: "无结果" + results_found: "条记录匹配" + back_to_top: "返回顶部" +zh: + <<: *DEFAULT_ZH_HANS +zh-CN: + <<: *DEFAULT_ZH_HANS +zh-SG: + <<: *DEFAULT_ZH_HANS + +zh-Hant: &DEFAULT_ZH_HANT + skip_links: "跳過連結" + skip_primary_nav: "跳至主導覽" + skip_content: "跳至內容" + skip_footer: "跳至頁尾" + page: "頁面" + pagination_previous: "上一頁" + pagination_next: "下一頁" + breadcrumb_home_label: "首頁" + breadcrumb_separator: "/" + menu_label: "選單" + search_label: "搜尋" + toc_label: "本頁目錄" + ext_link_label: "外部連結" + less_than: "少於" + minute_read: "分鐘閱讀" + share_on_label: "分享至" + meta_label: + tags_label: "標籤:" + categories_label: "分類:" + date_label: "更新時間:" + comments_label: "留言" + comments_title: "留言" + more_label: "閱讀更多" + related_label: "您可能也會有興趣" + follow_label: "追蹤:" + feed_label: "訂閱 Feed" + powered_by: "採用技術:" + website_label: "網站" + email_label: "電子郵件" + recent_posts: "最新文章" + undefined_wpm: "設定檔 (_config.yml) 中缺少 `words_per_minute` 參數" + comment_form_info: "您的電子郵件不會被公開。必填欄位已標註星號 (*)" + comment_form_comment_label: "留言" + comment_form_md_info: "支援 Markdown 語法。" + comment_form_name_label: "名稱" + comment_form_email_label: "電子郵件地址" + comment_form_website_label: "網站 (選填)" + comment_btn_submit: "送出留言" + comment_btn_submitted: "已送出" + comment_success_msg: "感謝您的留言! 審核後將會顯示在站上。" + comment_error_msg: "抱歉,您提交的資料有誤。請確認所有必填欄位皆已正確填寫後再試一次。" + loading_label: "載入中..." + search_label_text: "輸入您要搜尋的關鍵字..." + search_placeholder_text: "輸入您要搜尋的關鍵字..." + search_algolia_no_results: "找不到結果" + results_found: "找到結果" + back_to_top: "回到頁首" +zh-TW: + <<: *DEFAULT_ZH_HANT +zh-HK: + <<: *DEFAULT_ZH_HANT diff --git a/_includes/seo.html b/_includes/seo.html index 71892c66..976e12fa 100644 --- a/_includes/seo.html +++ b/_includes/seo.html @@ -47,7 +47,7 @@ {% endif %} - + diff --git a/_layouts/default.html b/_layouts/default.html index 69a93c59..c4debdff 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,15 +5,17 @@ {% include copyright.html %} - + {% include head.html %} {% include head/custom.html %} - {% if site.preview and site.preview.pr-number %} -
当前站点为预览构建而非官方文档。如需反馈问题,请前往 #{{ site.preview.pr-number }} 留言。
+ {% if site.preview and site.preview.enabled != false %} + {%- assign i18n_text = site.data.plugins.i18n | i18n: locale, "ui-text" %} + {%- assign i18n_preview = i18n_text.data.preview %} +
{{ i18n_preview.before }}{% if site.preview.feedback and site.preview.feedback.name %}{{ i18n_preview.feedback.before }}{% if site.preview.feedback.url %}{{ site.preview.feedback.name }}{% else %}{{ site.preview.feedback.name }}{% endif %}{{ i18n_preview.feedback.after }}{% endif %}{{ i18n_preview.after }}
{% endif %} {% include_cached skip-links.html locale=locale %} diff --git a/_layouts/document.html b/_layouts/document.html index 3b4bd7db..2ca8e55c 100644 --- a/_layouts/document.html +++ b/_layouts/document.html @@ -1,13 +1,47 @@ --- layout: single --- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} -{% if jekyll.environment == 'production' and page.hits %} +{%- if jekyll.environment == "production" and page.hits -%} Hits -{% endif %} +{%- endif %} -
-

本文由 {{ page.author | default: '未署名用户' }} 创建{% if page.contributors %},并由 {{ page.contributors | join: ' ' }} 编辑{% endif %}。

+{%- assign i18n_text = site.data.plugins.i18n | i18n: locale, "ui-text" %} +{%- assign i18n_locale = i18n_text.data.locale %} +{%- if page.origin.locale and page.locale and page.origin.locale != page.locale -%} +{%- assign i18n_locale_warning = i18n_text.data.locale_warning %} +
{{ i18n_locale_warning.before }}{{ i18n_locale[page.origin.locale] }}{{ i18n_locale_warning.after }}
+{%- endif %} + +
+ {%- assign i18n_info = i18n_text.data.info -%} + {{ i18n_info.byline.author.before }}{{ page.author | default: i18n_info.byline.author.default }}{{ i18n_info.byline.author.after }} + {%- if page.contributors %}{{ i18n_info.byline.contributors.before }}{{ page.contributors | join: ' ' }}{{ i18n_info.byline.contributors.after }}{% endif -%} + {%- assign translations = page.default.translations | where_exp: "item", "item.locale != page.locale" -%} + {%- assign translations_size = translations | size -%} + {%- assign fallbacks = page.default.fallbacks | where_exp: "item", "item.locale != page.locale" -%} + {%- assign fallbacks_size = fallbacks | size -%} + {%- assign size = translations_size | plus: fallbacks_size -%} + {%- if size > 0 -%} + {{ i18n_info.i18n.before }} + {%- if translations_size > 0 -%} + {%- assign i18n_translations = i18n_info.i18n.translations -%} + {%- capture i18n_translations_links %}{% for item in translations %}{{ i18n_locale[item.locale] }} {% assign i18n_item_text = site.data.plugins.i18n | i18n: item.locale, "ui-text" %}{{ i18n_item_text.data.locale[item.locale] }} {% endfor %}{% endcapture -%} + {{ i18n_translations.before }}{{ i18n_translations_links | strip }}{{ i18n_translations.after }} + {%- endif -%} + {%- if translations_size > 0 and fallbacks_size > 0 -%} + {{ i18n_info.i18n.between }} + {%- endif -%} + {%- if fallbacks_size > 0 -%} + {%- assign i18n_fallbacks = i18n_info.i18n.fallbacks -%} + {%- capture i18n_fallbacks_links %}{% for item in fallbacks %}{{ i18n_locale[item.locale] }} {% assign i18n_item_text = site.data.plugins.i18n | i18n: item.locale, "ui-text" %}{{ i18n_item_text.data.locale[item.locale] }} {% endfor %}{% endcapture -%} + {{ i18n_fallbacks.before }}{{ i18n_fallbacks_links | strip }}{{ i18n_fallbacks.after }} + {%- endif -%} + {{ i18n_info.i18n.after }} + {%- endif -%} + {{ i18n_info.end }} + {%- comment %}{% endcomment -%}
{{ content }} diff --git a/_plugins/i18n.rb b/_plugins/i18n.rb new file mode 100644 index 00000000..e9c3c635 --- /dev/null +++ b/_plugins/i18n.rb @@ -0,0 +1,101 @@ +module Jekyll + class DataReader + def sanitize_filename(name) + name.gsub(%r![^\w\s.-]+|(?<=^|\b\s)\s+(?=$|\s?\b)!, "") + .gsub(%r!\s+!, "_") + end + end +end + +module I18nFilter + def i18n(hash, locale, key) + return nil unless hash.is_a?(Hash) && locale.is_a?(String) && key.is_a?(String) + return nil unless hash.key?(key) + + locale_key = "#{key}.#{locale}" + return { "locale" => locale, "data" => hash[locale_key] } if hash.key? locale_key + + site = @context.registers[:site] + default_locale = site.config["locale"].is_a?(String) ? site.config["locale"] : "en" + { "locale" => default_locale, "data" => hash[key] } + end +end + +Liquid::Template.register_filter(I18nFilter) + +Jekyll::Hooks.register [:site], :pre_render do |site| + default_locale = site.config["locale"] || "en" + locales = Array(site.config["locales"] || default_locale) + locales.unshift(default_locale) unless locales.include?(default_locale) + return if locales.empty? + + plugins = site.data["plugins"] + return unless plugins.is_a?(Hash) + + i18n_data = plugins["i18n"] + fallback_data = i18n_data.is_a?(Hash) ? i18n_data["fallback"] : nil + return unless fallback_data.is_a?(Hash) + + docs_map = {} + + (site.pages + site.documents).each do |doc| + next unless doc.data["i18n"] == true + next unless doc.is_a?(Jekyll::Page) or doc.is_a?(Jekyll::Document) + + path_parts = doc.path.split("/") + next if path_parts.empty? + + basename = path_parts[-1] + basename_parts = basename.split(".") + + doc_locale = (basename_parts.length < 3 || !locales.include?(basename_parts[-2])) ? default_locale : basename_parts[-2] + path_parts[-1] = "#{basename_parts[0..-3].join(".")}.#{basename_parts[-1]}" unless doc_locale == default_locale + default_doc_path = path_parts.join('/') + docs_map[default_doc_path] ||= {} + docs_map[default_doc_path][doc_locale] = doc + end + + docs_map.each_value do |docs| + default_doc = docs[default_locale] + next unless default_doc + default_doc.data["fallbacks"] = {} + default_doc.data["translations"] = docs + + locales.each do |locale| + if docs[locale] + docs[locale].data["locale"] = locale + docs[locale].data["origin"] = docs[locale] + docs[locale].data["default"] = default_doc + unless locale == default_locale + docs[locale].data["permalink"] = "/#{locale}#{default_doc.url}" + docs[locale].instance_variable_set(:@url, nil) + end + else + fallback_locale = fallback_data[locale] + while fallback_locale + fallback_doc = docs[fallback_locale] + break if fallback_doc + fallback_locale = fallback_data[fallback_locale] + end + fallback_doc ||= default_doc + + if fallback_doc.is_a?(Jekyll::Page) + base, dir, name = fallback_doc.instance_variable_get(:@base), fallback_doc.instance_variable_get(:@dir), fallback_doc.instance_variable_get(:@name) + new_doc = Jekyll::PageWithoutAFile.new(fallback_doc.site, base, dir, name) + site.pages << new_doc + else + path, collection = fallback_doc.instance_variable_get(:@path), fallback_doc.collection + new_doc = Jekyll::Document.new(path, site: fallback_doc.site, collection: collection) + collection.docs << new_doc + end + + default_doc.data["fallbacks"][locale] = new_doc + + new_doc.content = fallback_doc.content + fallback_doc.data.each { |k, v| new_doc.data[k] = v } + new_doc.data["permalink"] = "/#{locale}#{fallback_doc.url}" + new_doc.data["locale"] = locale + end + end + end +end From 52ba0d5745d2e87d0d8aef31171e62dd1d6e6ab3 Mon Sep 17 00:00:00 2001 From: neveler <55753029+neveler@users.noreply.github.com> Date: Fri, 5 Dec 2025 13:53:13 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _data/navigation.yml | 55 ------------------------------- _data/navigation/docs.en.yml | 40 ++++++++++++++++++++++ _data/navigation/docs.yml | 48 +++++++++++++++++++++++++++ _data/navigation/docs.zh-Hant.yml | 48 +++++++++++++++++++++++++++ _data/navigation/main.en.yml | 4 +++ _data/navigation/main.yml | 4 +++ _data/navigation/main.zh-Hant.yml | 4 +++ _includes/masthead.html | 5 +-- _includes/nav_list | 6 ++-- 9 files changed, 154 insertions(+), 60 deletions(-) delete mode 100644 _data/navigation.yml create mode 100644 _data/navigation/docs.en.yml create mode 100644 _data/navigation/docs.yml create mode 100644 _data/navigation/docs.zh-Hant.yml create mode 100644 _data/navigation/main.en.yml create mode 100644 _data/navigation/main.yml create mode 100644 _data/navigation/main.zh-Hant.yml diff --git a/_data/navigation.yml b/_data/navigation.yml deleted file mode 100644 index 495382ba..00000000 --- a/_data/navigation.yml +++ /dev/null @@ -1,55 +0,0 @@ -main: - - title: 常见问题 - url: /faq.html - - title: 设置 - url: /settings.html - -docs: - - title: 问题集合 - children: - - title: 常见问题 - url: /faq.html - - title: 启动器使用相关 - url: /launcher/ - - title: 整合包帮助 - url: /modpack/ - - title: 多人联机帮助 - url: /multiplayer/ - - title: 使用者帮助 - children: - - title: 版本隔离 - url: /launcher/isolation.html - description: 本文可以帮助你更好的分离版本间的地图、模组等内容。 - - title: 设置离线皮肤 - url: /launcher/offline-skin.html - description: 本文将告诉你如何设置一个属于自己的离线皮肤。 - - title: HMCL 的自动安装使用教程 - url: /launcher/auto-installing.html - description: 本文将告诉你如何用 HMCL 安装 Forge、Fabric、Fabric API、LiteLoader、Optifine 以及 模组 等。 - - title: 安装光影 - url: /launcher/shader.html - description: 本文将告诉你如何安装光影。 - - title: 设置项详解 - url: /launcher/set-item-details.html - description: 这篇文章针对 HMCL 的各个设置项进行了详细的解释。 - - title: 开发者帮助 - children: - - title: 制作 HMCL 格式的数据包 - url: /launcher/datapack.html - description: 本文将告诉你如何制作 HMCL 能够识别的数据包(Datapacks)。 - - title: 制作整合包 - url: /modpack/serverpack.html - description: 本文将告诉你如何制作整合包。 - - title: 添加默认 authlib-injector 验证服务器 - url: /launcher/authlib-injector.html - description: 本文将告诉你如何设置默认的验证服务器。 - - title: 其他 - children: - - title: 贡献指南 - url: /contribution.html - - title: HMCL GitHub 地址 - url: https://github.com/HMCL-dev/HMCL - - title: HMCL 帮助文档 GitHub 地址 - url: https://github.com/HMCL-dev/HMCL-docs - - title: HMCL 官网 - url: https://hmcl.huangyuhui.net diff --git a/_data/navigation/docs.en.yml b/_data/navigation/docs.en.yml new file mode 100644 index 00000000..3079b6f4 --- /dev/null +++ b/_data/navigation/docs.en.yml @@ -0,0 +1,40 @@ +- title: Questions + children: + - title: FAQ + url: /en/faq.html + - title: Launcher + url: /en/launcher/ + - title: Modpack + url: /en/modpack/ + - title: Multiplayer + url: /en/multiplayer/ +- title: User Guide + children: + - title: Isolation + url: /en/launcher/isolation.html + - title: Offline Skin + url: /en/launcher/offline-skin.html + - title: Automatic Installing + url: /en/launcher/auto-installing.html + - title: Shader + url: /en/launcher/shader.html + - title: Set Item Details + url: /en/launcher/set-item-details.html +- title: Developer Guide + children: + - title: Datapack + url: /en/launcher/datapack.html + - title: Serverpack + url: /en/modpack/serverpack.html + - title: Authlib Injector + url: /en/launcher/authlib-injector.html +- title: Other + children: + - title: Contribution Guide + url: /en/contribution.html + - title: Official Website + url: https://hmcl.huangyuhui.net + - title: Project Repository + url: https://github.com/HMCL-dev/HMCL + - title: Documentation Repository + url: https://github.com/HMCL-dev/HMCL-docs diff --git a/_data/navigation/docs.yml b/_data/navigation/docs.yml new file mode 100644 index 00000000..b930e909 --- /dev/null +++ b/_data/navigation/docs.yml @@ -0,0 +1,48 @@ +- title: 问题集合 + children: + - title: 常见问题 + url: /faq.html + - title: 启动器使用相关 + url: /launcher/ + - title: 整合包帮助 + url: /modpack/ + - title: 多人联机帮助 + url: /multiplayer/ +- title: 使用者帮助 + children: + - title: 版本隔离 + url: /launcher/isolation.html + description: 本文可以帮助你更好的分离版本间的地图、模组等内容。 + - title: 设置离线皮肤 + url: /launcher/offline-skin.html + description: 本文将告诉你如何设置一个属于自己的离线皮肤。 + - title: HMCL 的自动安装使用教程 + url: /launcher/auto-installing.html + description: 本文将告诉你如何用 HMCL 安装 Forge、Fabric、Fabric API、LiteLoader、Optifine 以及 模组 等。 + - title: 安装光影 + url: /launcher/shader.html + description: 本文将告诉你如何安装光影。 + - title: 设置项详解 + url: /launcher/set-item-details.html + description: 这篇文章针对 HMCL 的各个设置项进行了详细的解释。 +- title: 开发者帮助 + children: + - title: 制作 HMCL 格式的数据包 + url: /launcher/datapack.html + description: 本文将告诉你如何制作 HMCL 能够识别的数据包(Datapacks)。 + - title: 制作整合包 + url: /modpack/serverpack.html + description: 本文将告诉你如何制作整合包。 + - title: 添加默认 authlib-injector 验证服务器 + url: /launcher/authlib-injector.html + description: 本文将告诉你如何设置默认的验证服务器。 +- title: 其它 + children: + - title: 贡献指南 + url: /contribution.html + - title: 官方网站 + url: https://hmcl.huangyuhui.net + - title: 项目仓库 + url: https://github.com/HMCL-dev/HMCL + - title: 文档仓库 + url: https://github.com/HMCL-dev/HMCL-docs diff --git a/_data/navigation/docs.zh-Hant.yml b/_data/navigation/docs.zh-Hant.yml new file mode 100644 index 00000000..adf1782b --- /dev/null +++ b/_data/navigation/docs.zh-Hant.yml @@ -0,0 +1,48 @@ +- title: 問題集合 + children: + - title: 常見問題 + url: /zh-Hant/faq.html + - title: 啟動器使用相關 + url: /zh-Hant/launcher/ + - title: 整合包幫助 + url: /zh-Hant/modpack/ + - title: 多人聯機幫助 + url: /zh-Hant/multiplayer/ +- title: 使用者幫助 + children: + - title: 版本隔離 + url: /zh-Hant/launcher/isolation.html + description: 本文可以幫助你更好的分離版本間的地圖、模組等內容。 + - title: 設置離線皮膚 + url: /zh-Hant/launcher/offline-skin.html + description: 本文將告訴你如何設置一個屬於自己的離線皮膚。 + - title: HMCL 的自動安裝使用教程 + url: /zh-Hant/launcher/auto-installing.html + description: 本文將告訴你如何用 HMCL 安裝 Forge、Fabric、Fabric API、LiteLoader、Optifine 以及 模組 等。 + - title: 安裝光影 + url: /zh-Hant/launcher/shader.html + description: 本文將告訴你如何安裝光影。 + - title: 設置項詳解 + url: /zh-Hant/launcher/set-item-details.html + description: 這篇文章針對 HMCL 的各個設置項進行了詳細的解釋。 +- title: 開髮者幫助 + children: + - title: 製作 HMCL 格式的數據包 + url: /zh-Hant/launcher/datapack.html + description: 本文將告訴你如何製作 HMCL 能夠識別的數據包(Datapacks)。 + - title: 製作整合包 + url: /zh-Hant/modpack/serverpack.html + description: 本文將告訴你如何製作整合包。 + - title: 添加默認 authlib-injector 驗証服務器 + url: /zh-Hant/launcher/authlib-injector.html + description: 本文將告訴你如何設置默認的驗証服務器。 +- title: 其它 + children: + - title: 貢獻指南 + url: /zh-Hant/contribution.html + - title: 官方網站 + url: https://hmcl.huangyuhui.net + - title: 項目倉庫 + url: https://github.com/HMCL-dev/HMCL + - title: 文檔倉庫 + url: https://github.com/HMCL-dev/HMCL-docs diff --git a/_data/navigation/main.en.yml b/_data/navigation/main.en.yml new file mode 100644 index 00000000..37158eaa --- /dev/null +++ b/_data/navigation/main.en.yml @@ -0,0 +1,4 @@ +- title: FAQ + url: /en/faq.html +- title: Settings + url: /en/settings.html diff --git a/_data/navigation/main.yml b/_data/navigation/main.yml new file mode 100644 index 00000000..db6bedf1 --- /dev/null +++ b/_data/navigation/main.yml @@ -0,0 +1,4 @@ +- title: 常见问题 + url: /faq.html +- title: 设置 + url: /settings.html diff --git a/_data/navigation/main.zh-Hant.yml b/_data/navigation/main.zh-Hant.yml new file mode 100644 index 00000000..62fd0590 --- /dev/null +++ b/_data/navigation/main.zh-Hant.yml @@ -0,0 +1,4 @@ +- title: 常見問題 + url: /zh-Hant/faq.html +- title: 設置 + url: /zh-Hant/settings.html diff --git a/_includes/masthead.html b/_includes/masthead.html index 85dc14e0..bf85ca44 100644 --- a/_includes/masthead.html +++ b/_includes/masthead.html @@ -13,8 +13,9 @@ {% if site.subtitle %}{{ site.subtitle | escape_once | strip }}{% endif %}