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/404.en.md b/404.en.md new file mode 100644 index 00000000..41d36c9d --- /dev/null +++ b/404.en.md @@ -0,0 +1,9 @@ +--- +layout: splash +sitemap: false +--- + +
+

404

+

Page Not Found

+
diff --git a/404.md b/404.md index b6608394..9a52c58e 100644 --- a/404.md +++ b/404.md @@ -1,8 +1,21 @@ --- layout: splash +sitemap: false ---

404

页面不存在

+ + -> [!NOTE] -> -> Changelogs are written in Chinese. - -> [!NOTE] -> -> Changelogs are written in Chinese. - + + \ 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..63502e7f --- /dev/null +++ b/_includes/breadcrumbs.html @@ -0,0 +1,42 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- capture home_url %}/{% if locale != site.locale %}{{ locale }}/{% endif %}{% endcapture -%} +{% 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..990403bc --- /dev/null +++ b/_includes/documents-collection.html @@ -0,0 +1,17 @@ +{% assign entries = include.entries | default: site[include.collection] | where_exp: "post", "post.hidden != true" %} + +{% if include.locale %} + {% assign entries = entries | where: "locale", include.locale %} +{% endif %} + +{% 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..1268ca78 --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,29 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} +{% 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/head.html b/_includes/head.html index f56ebb6b..799d0428 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -1,9 +1,12 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} {% include seo.html %} {% unless site.atom_feed.hide %} - + {% endunless %} {%- comment %} https://docs.google.com/presentation/d/1rmxwWa9P6_xHqonmh5ONXRS-jPc5XKbnv99Rjkhe04s/present {% endcomment -%} diff --git a/_includes/head/custom.html b/_includes/head/custom.html index 55de7508..e1259af7 100644 --- a/_includes/head/custom.html +++ b/_includes/head/custom.html @@ -1,2 +1,3 @@ + diff --git a/_includes/masthead.html b/_includes/masthead.html new file mode 100644 index 00000000..44f29f80 --- /dev/null +++ b/_includes/masthead.html @@ -0,0 +1,45 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} +{%- capture logo_path %}{{ site.logo }}{% endcapture -%} +{%- capture home_url %}/{% if locale != site.locale %}{{ locale }}/{% endif %}{% endcapture -%} + +
+
+
+ +
+
+
diff --git a/_includes/nav_list b/_includes/nav_list new file mode 100644 index 00000000..7b1b17d1 --- /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..bbcd3be5 --- /dev/null +++ b/_includes/page__date.html @@ -0,0 +1,9 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_date_format = i18n_text.data.site.date_format | default: site.date_format -%} +{% 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..5286ed1a --- /dev/null +++ b/_includes/page__hero.html @@ -0,0 +1,56 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} +{% 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..0a0ddf15 --- /dev/null +++ b/_includes/page__meta.html @@ -0,0 +1,34 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_date_format = i18n_text.data.site.date_format | default: site.date_format -%} +{% 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..023241f2 --- /dev/null +++ b/_includes/post_pagination.html @@ -0,0 +1,24 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign next = page.next -%} +{%- assign previous = page.previous -%} +{%- assign collection = site.collections | where: "label", page.collection | first -%} +{%- for document in collection.docs -%} +{%- if page.locale == next.locale and page.locale == previous.locale %}{% break %}{% endif -%} +{%- if page.locale != next.locale %}{% assign next = next.next %}{% endif -%} +{%- if page.locale != previous.locale %}{% assign previous = previous.previous %}{% endif -%} +{%- endfor -%} + +{% if previous or 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..f0db9a58 --- /dev/null +++ b/_includes/seo.html @@ -0,0 +1,138 @@ +{% assign locale = include.locale | default: page.locale | default: layout.locale | default: site.locale %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} +{%- assign site_description = i18n_text.data.site.description | default: site.description -%} + +{%- 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/changelog.html b/_layouts/changelog.html index 9a72f040..58d40750 100644 --- a/_layouts/changelog.html +++ b/_layouts/changelog.html @@ -5,9 +5,15 @@ {{ content }} {% assign channel = page.channel | default: 'stable' %} -{% assign changelogs = site.changelogs | where: "channel", channel | reverse %} +{% assign changelogs = site.changelogs | where: "locale", page.locale | where: "channel", channel | sort: "slug" | reverse %} {% for item in changelogs %} - {% assign version = item.slug %} -

HMCL {{ version }}

-
{{ item.content | markdownify }}
+ {% assign version = item.default.slug %} +

HMCL {{ version }}

+ {%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" %} + {%- if item.origin.locale != page.locale -%} + {%- assign i18n_locale = i18n_text.data.locale %} + {%- assign i18n_locale_warning = i18n_text.data.locale_warning %} +
{{ i18n_locale_warning.before }}{{ i18n_locale[item.origin.locale] }}{{ i18n_locale_warning.after }}
+ {%- endif %} +
{{ item.content | markdownify }}
{% endfor %} diff --git a/_layouts/collection.html b/_layouts/collection.html new file mode 100644 index 00000000..3f6d96bc --- /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 locale=page.locale 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..c4debdff 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,41 +1,44 @@ ---- -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.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 %} + {% 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/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/_layouts/feed.xml b/_layouts/feed.xml new file mode 100644 index 00000000..90294afa --- /dev/null +++ b/_layouts/feed.xml @@ -0,0 +1,117 @@ + +{% if page.xsl %} + +{% endif %} +{%- assign locale = page.locale | default: site.locale | default: "en" %} +{%- assign i18n_text = site.data.plugins.i18n | i18n: page.locale, "ui-text" -%} +{%- assign site_title = i18n_text.data.site.title | default: site.title -%} +{%- assign site_description = i18n_text.data.site.description | default: site.description -%} +{%- capture home_url %}/{% if locale != site.locale %}{{ locale }}/{% endif %}{% endcapture -%} + + Jekyll + + + {{ site.time | date_to_xmlschema }} + {{ page.url | absolute_url | xml_escape }} + + {% assign title = site_title | default: site.name %} + {% if page.collection != "posts" %} + {% assign collection = page.collection | capitalize %} + {% assign title = title | append: " | " | append: collection %} + {% endif %} + {% if page.category %} + {% assign category = page.category | capitalize %} + {% assign title = title | append: " | " | append: category %} + {% endif %} + + {% if title %} + {{ title | smartify | xml_escape }} + {% endif %} + + {% if site_description %} + {{ site_description | xml_escape }} + {% endif %} + + {% if site.author %} + + {{ site.author.name | default: site.author | xml_escape }} + {% if site.author.email %} + {{ site.author.email | xml_escape }} + {% endif %} + {% if site.author.uri %} + {{ site.author.uri | xml_escape }} + {% endif %} + + {% endif %} + + {% if page.tags %} + {% assign posts = site.tags[page.tags] %} + {% else %} + {% assign posts = site[page.collection] %} + {% endif %} + {% if page.category %} + {% assign posts = posts | where: "categories", page.category %} + {% endif %} + {% unless site.show_drafts %} + {% assign posts = posts | where_exp: "post", "post.draft != true" %} + {% endunless %} + {% assign posts = posts | where: "locale", locale | sort: "date" | reverse %} + {% assign posts_limit = site.feed.posts_limit | default: 10 %} + {% for post in posts limit: posts_limit %} + + {% assign post_title = post.title | smartify | strip_html | normalize_whitespace | xml_escape %} + + {{ post_title }} + + {{ post.date | date_to_xmlschema }} + {{ post.last_modified_at | default: post.date | date_to_xmlschema }} + {{ post.id | absolute_url | xml_escape }} + {% assign excerpt_only = post.feed.excerpt_only | default: site.feed.excerpt_only %} + {% unless excerpt_only %} + + {% endunless %} + + {% assign post_author = post.author | default: post.authors[0] | default: site.author %} + {% assign post_author = site.data.authors[post_author] | default: post_author %} + {% assign post_author_email = post_author.email | default: nil %} + {% assign post_author_uri = post_author.uri | default: nil %} + {% assign post_author_name = post_author.name | default: post_author %} + + + {{ post_author_name | default: "" | xml_escape }} + {% if post_author_email %} + {{ post_author_email | xml_escape }} + {% endif %} + {% if post_author_uri %} + {{ post_author_uri | xml_escape }} + {% endif %} + + + {% if post.category %} + + {% elsif post.categories %} + {% for category in post.categories %} + + {% endfor %} + {% endif %} + + {% for tag in post.tags %} + + {% endfor %} + + {% assign post_summary = post.description | default: post.excerpt %} + {% if post_summary and post_summary != empty %} + + {% endif %} + + {% assign post_image = post.image.path | default: post.image %} + {% if post_image %} + {% unless post_image contains "://" %} + {% assign post_image = post_image | absolute_url %} + {% endunless %} + + + {% endif %} + + {% endfor %} + diff --git a/_layouts/home.html b/_layouts/home.html index e45ab726..b8c3ce7e 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -4,8 +4,9 @@ {{ content }} +{% assign navigation = site.data.navigation | i18n: page.locale, "docs" %} {% capture list %} -{% for group in site.data.navigation.docs -%} +{% for group in navigation.data -%} ## {{ group.title }} {% for item in group.children -%} 1. [{{ item.title }}]({{ item.url | relative_url }}) @@ -16,4 +17,4 @@ {% endfor %} {% endcapture %} -{{ list | markdownify }} +
{{ list | markdownify }}
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/robots.txt b/_layouts/robots.txt new file mode 100644 index 00000000..a699016f --- /dev/null +++ b/_layouts/robots.txt @@ -0,0 +1 @@ +Sitemap: {{ "sitemap.xml" | absolute_url }} 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/settings.html b/_layouts/settings.html index af675a0c..1359fae1 100644 --- a/_layouts/settings.html +++ b/_layouts/settings.html @@ -1,6 +1,7 @@ --- layout: document --- +{%- assign locale = page.locale | default: layout.locale | default: site.locale %} {% for group in page.data %} @@ -8,12 +9,11 @@ ## {{ group.title }} -{% for pair in group.settings %} -{% assign name = pair[0] %} -{% assign value = pair[1] %} +{% for name in group.settings %} {% assign setting = site.data.settings[name] %} - {% if setting.type == 'radio' %} +{% assign i18n = site.data.plugins.i18n | i18n: locale, "ui-text" %} +{% assign value = i18n.data.settings[name] %}
  • {{ value.title }}
  • 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/sitemap.xml b/_layouts/sitemap.xml new file mode 100644 index 00000000..4dc972e3 --- /dev/null +++ b/_layouts/sitemap.xml @@ -0,0 +1,57 @@ + +{% if page.xsl %} + +{% endif %} + + {% assign collections = site.collections | where_exp:'collection','collection.output != false' %} + {% for collection in collections %} + {%- assign locale = page.locale | default: site.locale | default: "en" %} + {% assign docs = collection.docs | where: "locale", locale | where_exp:'doc','doc.sitemap != false' %} + {% for doc in docs %} + + {{ doc.url | replace:'/index.html','/' | absolute_url | xml_escape }} + {% if doc.last_modified_at or doc.date %} + {{ doc.last_modified_at | default: doc.date | date_to_xmlschema }} + {% endif %} + {% if doc.default.translations %} + {% for item in doc.default.translations %} + + {% endfor %} + {% endif %} + {% if doc.default.fallbacks %} + {% for item in doc.default.fallbacks %} + + {% endfor %} + {% endif %} + + {% endfor %} + {% endfor %} + + {% assign pages = site.html_pages | where: "locale", locale | where_exp:'doc','doc.sitemap != false' | where_exp:'doc','doc.url != "/404.html"' %} + {% for page in pages %} + + {{ page.url | replace:'/index.html','/' | absolute_url | xml_escape }} + {% if page.last_modified_at or page.date %} + {{ page.last_modified_at | default: page.date | date_to_xmlschema }} + {% endif %} + {% if page.default.translations %} + {% for item in page.default.translations %} + + {% endfor %} + {% endif %} + {% if page.default.fallbacks %} + {% for item in page.default.fallbacks %} + + {% endfor %} + {% endif %} + + {% endfor %} + + {% assign static_files = page.static_files | where_exp:'page','page.sitemap != false' | where_exp:'page','page.name != "404.html"' %} + {% for file in static_files %} + + {{ file.path | replace:'/index.html','/' | absolute_url | xml_escape }} + {{ file.modified_time | date_to_xmlschema }} + + {% endfor %} + 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 %} diff --git a/_pages/docs.en.md b/_pages/docs.en.md new file mode 100644 index 00000000..fdc29694 --- /dev/null +++ b/_pages/docs.en.md @@ -0,0 +1,7 @@ +--- +title: Documents +layout: collection +collection: docs +entries_layout: grid +classes: wide +--- diff --git a/_pages/docs.md b/_pages/docs.md index 4d961fc4..d57ca144 100644 --- a/_pages/docs.md +++ b/_pages/docs.md @@ -5,4 +5,4 @@ permalink: /docs/ collection: docs entries_layout: grid classes: wide ---- \ No newline at end of file +--- diff --git a/_pages/docs.zh-Hant.md b/_pages/docs.zh-Hant.md new file mode 100644 index 00000000..3823413f --- /dev/null +++ b/_pages/docs.zh-Hant.md @@ -0,0 +1,7 @@ +--- +title: 文檔 +layout: collection +collection: docs +entries_layout: grid +classes: wide +--- diff --git a/_pages/downloads.en.md b/_pages/downloads.en.md new file mode 100644 index 00000000..c7cc61bc --- /dev/null +++ b/_pages/downloads.en.md @@ -0,0 +1,7 @@ +--- +title: Downloads +layout: collection +collection: downloads +entries_layout: grid +classes: wide +--- diff --git a/_pages/downloads.zh-Hant.md b/_pages/downloads.zh-Hant.md new file mode 100644 index 00000000..f24705b7 --- /dev/null +++ b/_pages/downloads.zh-Hant.md @@ -0,0 +1,7 @@ +--- +title: 下載 +layout: collection +collection: downloads +entries_layout: grid +classes: wide +--- diff --git a/_pages/launcher.en.md b/_pages/launcher.en.md new file mode 100644 index 00000000..5794420e --- /dev/null +++ b/_pages/launcher.en.md @@ -0,0 +1,7 @@ +--- +title: Launcher +layout: collection +collection: launcher +entries_layout: grid +classes: wide +--- diff --git a/_pages/launcher.md b/_pages/launcher.md index 3468e63f..25f73c4d 100644 --- a/_pages/launcher.md +++ b/_pages/launcher.md @@ -5,4 +5,4 @@ permalink: /launcher/ collection: launcher entries_layout: grid classes: wide ---- \ No newline at end of file +--- diff --git a/_pages/launcher.zh-Hant.md b/_pages/launcher.zh-Hant.md new file mode 100644 index 00000000..5e022588 --- /dev/null +++ b/_pages/launcher.zh-Hant.md @@ -0,0 +1,7 @@ +--- +title: 啟動器 +layout: collection +collection: launcher +entries_layout: grid +classes: wide +--- diff --git a/_pages/modpack.en.md b/_pages/modpack.en.md new file mode 100644 index 00000000..ba6c9051 --- /dev/null +++ b/_pages/modpack.en.md @@ -0,0 +1,7 @@ +--- +title: Modpack +layout: collection +collection: modpack +entries_layout: grid +classes: wide +--- diff --git a/_pages/modpack.md b/_pages/modpack.md index 5013c3fc..8248bfc9 100644 --- a/_pages/modpack.md +++ b/_pages/modpack.md @@ -5,4 +5,4 @@ permalink: /modpack/ collection: modpack entries_layout: grid classes: wide ---- \ No newline at end of file +--- diff --git a/_pages/modpack.zh-Hant.md b/_pages/modpack.zh-Hant.md new file mode 100644 index 00000000..f1fd7256 --- /dev/null +++ b/_pages/modpack.zh-Hant.md @@ -0,0 +1,7 @@ +--- +title: 整合包 +layout: collection +collection: modpack +entries_layout: grid +classes: wide +--- diff --git a/_pages/multiplayer.en.md b/_pages/multiplayer.en.md new file mode 100644 index 00000000..1c2fd157 --- /dev/null +++ b/_pages/multiplayer.en.md @@ -0,0 +1,7 @@ +--- +title: Multiplayer +layout: collection +collection: multiplayer +entries_layout: grid +classes: wide +--- diff --git a/_pages/multiplayer.zh-Hant.md b/_pages/multiplayer.zh-Hant.md new file mode 100644 index 00000000..002a0747 --- /dev/null +++ b/_pages/multiplayer.zh-Hant.md @@ -0,0 +1,7 @@ +--- +title: 多人聯機 +layout: collection +collection: multiplayer +entries_layout: grid +classes: wide +--- diff --git a/_plugins/auto-alert.rb b/_plugins/auto-alert.rb index ee0d1b82..f740f5ac 100644 --- a/_plugins/auto-alert.rb +++ b/_plugins/auto-alert.rb @@ -4,7 +4,9 @@ next unless doc.output_ext == ".html" site = doc.site next unless site.data["plugins"] - alert_type = site.data["plugins"]["auto_alert"] + locale = doc.data["locale"] + alert_type = site.data["plugins"]["auto_alert.#{locale}"] if locale + alert_type = site.data["plugins"]["auto_alert"] unless alert_type next unless alert_type fragment = Nokogiri::HTML::DocumentFragment.parse(doc.content) diff --git a/_plugins/i18n.rb b/_plugins/i18n.rb new file mode 100644 index 00000000..2d6a91cb --- /dev/null +++ b/_plugins/i18n.rb @@ -0,0 +1,133 @@ +module JekyllFeed + class Generator < Jekyll::Generator + def feed_source_path + @feed_source_path ||= File.expand_path "_layouts/feed.xml", @site.config["source"] + end + end +end + +module Jekyll + class JekyllSitemap < Jekyll::Generator + def source_path(file = "sitemap.xml") + File.expand_path "_layouts/#{file}", @site.config["source"] + end + + def sitemap + site_map = PageWithoutAFile.new(@site, __dir__, "", "sitemap.xml") + site_map.content = File.read(source_path).gsub(MINIFY_REGEX, "") + site_map.data["layout"] = nil + site_map.data["static_files"] = static_files.map(&:to_liquid) + site_map.data["xsl"] = file_exists?("sitemap.xsl") + site_map.data["i18n"] = false + site_map + end + + def robots + robots = PageWithoutAFile.new(@site, __dir__, "", "robots.txt") + robots.content = File.read(source_path("robots.txt")) + robots.data["layout"] = nil + robots.data["i18n"] = false + robots + end + end + + 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 diff --git a/assets/js/config.js b/assets/js/config.js new file mode 100644 index 00000000..89082ab7 --- /dev/null +++ b/assets/js/config.js @@ -0,0 +1,17 @@ +--- +layout: null +--- +(function (global) { + var config = {}; + config.locale = document.documentElement.lang + ""; + config.baseurl = "{{ '/' | relative_url }}"; + config.settings = /*{%comment%}*/{}/*{%endcomment%}*//**{{'/'}}{{ site.data.settings | jsonify }}/**/; + config.i18n = {}; + config.i18n.default = /*{%comment%}*/{};/*{%endcomment%}*//**{{'/'}}{{ site.data.plugins.i18n.ui-text | jsonify }}; + {% for locale in site.locales %} + {% assign data = site.data.plugins.i18n | i18n: locale, "ui-text" %} + config.i18n["{{ data.locale }}"] = {{ data.data | jsonify }} + {% endfor %} + /**/ + global.config = config; +})(window); diff --git a/assets/js/settings.js b/assets/js/settings.js index 13e6e59f..4c6becaf 100644 --- a/assets/js/settings.js +++ b/assets/js/settings.js @@ -1,11 +1,8 @@ ---- -layout: null ---- (function (global) { var PREFIX = "HMCL_DOCS_SETTINGS_"; var data = {}; var events = {}; - var config = /*{%comment%}*/{}/*{%endcomment%}*//**{{'/'}}{{ site.data.settings | jsonify }}/**/; + var config = global.config.settings; global.addEventListener("storage", function (event) { if (!event.key) return; diff --git a/assets/js/theme.js b/assets/js/theme.js index 9a202792..9abda20d 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -1,14 +1,11 @@ ---- -layout: null ---- window.addEventListener("DOMContentLoaded", function () { var skinLink = document.getElementById("skin"); var darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)"); function applyDarkSkin() { - skinLink.href = "{{ '/assets/css/skins/' | relative_url }}" + settings.get("appearance_skin_dark", "dark") + ".css"; + skinLink.href = config.baseurl + "assets/css/skins/" + settings.get("appearance_skin_dark", "dark") + ".css"; } function applyLightSkin() { - skinLink.href = "{{ '/assets/css/skins/' | relative_url }}" + settings.get("appearance_skin_light", "default") + ".css"; + skinLink.href = config.baseurl + "assets/css/skins/" + settings.get("appearance_skin_light", "default") + ".css"; } function autoSchemeHandler() { if (darkModeQuery.matches) { @@ -19,14 +16,13 @@ window.addEventListener("DOMContentLoaded", function () { } var activeModeIndex = 0; var modeKeys = ["light", "dark", "auto"]; - var modeLabels = ["亮色", "暗色", "自动"]; - + var modeLabels = config.i18n[config.locale || "default"].settings.appearance_color.options; var menuList = document.querySelector(".masthead .visible-links"); var modeSwitcher = null; if (menuList) { modeSwitcher = document.createElement("a"); modeSwitcher.className = "masthead__menu-item"; - modeSwitcher.textContent = modeLabels[activeModeIndex]; + modeSwitcher.textContent = modeLabels["light"]; modeSwitcher.href = "javascript:;"; modeSwitcher.onclick = function () { var nextIndex = (activeModeIndex + 1) % modeKeys.length; @@ -46,7 +42,7 @@ window.addEventListener("DOMContentLoaded", function () { var resolvedMode = modeKeys[activeModeIndex]; if (modeSwitcher) { - modeSwitcher.textContent = modeLabels[activeModeIndex]; + modeSwitcher.textContent = modeLabels[resolvedMode]; } if (resolvedMode === "light") { diff --git a/index.en.json b/index.en.json new file mode 100644 index 00000000..c70d117f --- /dev/null +++ b/index.en.json @@ -0,0 +1,20 @@ +--- +layout: null +collections: + - name: launcher + title: Launcher + - name: modpack + title: Modpack +--- +[ +{%- for collection in page.collections -%} +{"title":"{{ collection.title }}","items":[ +{%- assign documents = site[collection.name] | where: "locale", page.locale -%} +{%- for document in documents -%} +{"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"} +{%- unless forloop.last %},{% endunless -%} +{%- endfor -%} +]} +{%- unless forloop.last %},{% endunless -%} +{%- endfor -%} +] diff --git a/index.en.md b/index.en.md new file mode 100644 index 00000000..6cbe033b --- /dev/null +++ b/index.en.md @@ -0,0 +1,9 @@ +--- +layout: home +title: Get started +author: wifi-left +--- + +> [!NOTE] +> If you encounter a BUG, please send feedback in time to [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues).\ +> You can also submit your suggestions here. diff --git a/index.json b/index.json index 9d480417..d7e50797 100644 --- a/index.json +++ b/index.json @@ -9,7 +9,8 @@ collections: [ {%- for collection in page.collections -%} {"title":"{{ collection.title }}","items":[ -{%- for document in site[collection.name] -%} +{%- assign documents = site[collection.name] | where: "locale", page.locale -%} +{%- for document in documents -%} {"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"} {%- unless forloop.last %},{% endunless -%} {%- endfor -%} diff --git a/index.md b/index.md index 79b0119e..348287a0 100644 --- a/index.md +++ b/index.md @@ -1,20 +1,9 @@ --- layout: home -title: HMCL 新手导航 +title: 新手导航 author: wifi-left --- - -> [!NOTE] -> -> -> The articles were written in Simplified Chinese. If you want to help translate them, please send a pull request to [HMCL-docs/pulls](https://github.com/HMCL-dev/HMCL-docs/pulls). Or you can enable your translation tool to read.\ -> If you encounter a BUG, please send feedback in time to [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues).\ -> You can also submit your suggestions here. - - > [!NOTE] > 如果您遇到 BUG,请及时在 [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues) 发送反馈。\ > 您也可以在这里提交您的建议。 diff --git a/index.zh-Hant.json b/index.zh-Hant.json new file mode 100644 index 00000000..da8b01d8 --- /dev/null +++ b/index.zh-Hant.json @@ -0,0 +1,20 @@ +--- +layout: null +collections: + - name: launcher + title: 啟動器 + - name: modpack + title: 整合包 +--- +[ +{%- for collection in page.collections -%} +{"title":"{{ collection.title }}","items":[ +{%- assign documents = site[collection.name] | where: "locale", page.locale -%} +{%- for document in documents -%} +{"title":"{{ document.title }}","subtitle":"{{ document.excerpt }}","url":"{{ document.url | absolute_url }}"} +{%- unless forloop.last %},{% endunless -%} +{%- endfor -%} +]} +{%- unless forloop.last %},{% endunless -%} +{%- endfor -%} +] diff --git a/index.zh-Hant.md b/index.zh-Hant.md new file mode 100644 index 00000000..1fb403a3 --- /dev/null +++ b/index.zh-Hant.md @@ -0,0 +1,9 @@ +--- +layout: home +title: 新手導航 +author: wifi-left +--- + +> [!NOTE] +> 如果您遇到 BUG,請及時在 [HMCL/issues](https://github.com/HMCL-dev/HMCL/issues) 髮送反饋。\ +> 您也可以在這裡提交您的建議。 diff --git a/settings.en.md b/settings.en.md new file mode 100644 index 00000000..00da99b6 --- /dev/null +++ b/settings.en.md @@ -0,0 +1,10 @@ +--- +title: Settings +layout: settings +data: + - title: Appearance + settings: + - appearance_color + - appearance_skin_light + - appearance_skin_dark +--- diff --git a/settings.md b/settings.md new file mode 100644 index 00000000..72c98325 --- /dev/null +++ b/settings.md @@ -0,0 +1,11 @@ +--- +title: 设置 +layout: settings +permalink: /settings.html +data: + - title: 外观 + settings: + - appearance_color + - appearance_skin_light + - appearance_skin_dark +--- diff --git a/settings.yaml b/settings.yaml deleted file mode 100644 index d8d79aed..00000000 --- a/settings.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: 设置 -layout: settings -permalink: /settings.html -data: - - title: 外观 - settings: - appearance_color: - title: 颜色模式 - description: 用于切换站点主题颜色模式。 - options: - light: 亮色 - dark: 暗色 - auto: 自动 - appearance_skin_light: - title: 亮色皮肤 - description: 亮色模式下应用的皮肤。 - options: - default: 默认 - air: 天空 - aqua: 水蓝 - contrast: 高对比 - dark: 暗色 - dirt: 泥土 - neon: 霓虹 - mint: 薄荷 - plum: 梅紫 - sunrise: 日出 - appearance_skin_dark: - title: 暗色皮肤 - description: 暗色模式下应用的皮肤。 - options: - default: 默认 - air: 天空 - aqua: 水蓝 - contrast: 高对比 - dark: 暗色 - dirt: 泥土 - neon: 霓虹 - mint: 薄荷 - plum: 梅紫 - sunrise: 日出 ---- diff --git a/settings.zh-Hant.md b/settings.zh-Hant.md new file mode 100644 index 00000000..a5725d72 --- /dev/null +++ b/settings.zh-Hant.md @@ -0,0 +1,10 @@ +--- +title: 設置 +layout: settings +data: + - title: 外觀 + settings: + - appearance_color + - appearance_skin_light + - appearance_skin_dark +---