Compare commits

...
37 Commits
Author SHA1 Message Date
Jimmy Cai cef9fe2549 release: v2.2.0 2021-02-13 16:30:01 +01:00
Jimmy CaiandGitHub 21b42f0b6c feat: add archetypes (#145) 2021-02-13 15:55:56 +01:00
Jimmy CaiandGitHub 79412144d9 fix: disable svg image processing (#144)
* fix: disable svg image processing

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/132

* style: remove extra blank space
2021-02-13 12:57:19 +01:00
79d8c1db38 feat: Tencent video shortcode and remark42 integration (#143)
* 增加remark42的评论系统支持,config中增加对应配置。

* remark42评论系统,语言配置加入到config中,修正切换theme时评论区跟随主题切换。

* - 新增腾讯视频的支持
- 支持通过frontmatter配置在文章中插入音频

* 更新readme

* Delete README.md

* Create README.md

* Remove MetingJS

* fix(shortcode/tencent): switch to HTML5

The old one was showing video using Flash.

* style(comments): clean remark42 integration code

Co-authored-by: wood <wood@hfge.cn>
Co-authored-by: Wood <34589275+hfge@users.noreply.github.com>
2021-02-13 11:10:24 +01:00
Jimmy Cai 8b6622792d Merge branch 'master' of https://github.com/CaiJimmy/hugo-theme-stack 2021-02-12 15:01:32 +01:00
Jimmy Cai 1814a14c20 chore: update compiled SCSS file of v2.1.0 2021-02-12 15:01:28 +01:00
Jimmy CaiandGitHub bdd2bd429a fix(ci): use correct path for artifact 2021-02-12 14:59:37 +01:00
Jimmy Cai 6c27767dac release: 2.1.0 2021-02-12 14:57:51 +01:00
Jimmy CaiandGitHub e661fe2ead ci: build Hugo artifact (#142) 2021-02-12 13:30:52 +01:00
Jimmy CaiandGitHub 8b17b8a4ee feat: add data/external.yaml (#140)
* feat: add data/external.yaml

Manage all external resources URL in one file

* style: format data/external

* style(helper/external): error message

* remove whitespace
2021-02-12 13:21:43 +01:00
Jimmy CaiandGitHub 326c052a24 fix(article): code background (#139)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/126
2021-02-11 21:22:02 +01:00
Junwoo HwangandGitHub 9914bba42c fix: remove word-wrap property for Safari (#131) 2021-02-11 19:05:12 +01:00
Akatsuki RuiandGitHub a37ebbe2aa assets: fix font-family fallback (#130)
If not have monospace, fonts will fallback to sans-serif when these fonts not available.
2021-02-11 19:00:59 +01:00
83e3a4e8e1 feat: Google Analytics support (#135)
* Added Google Analytics feature

* style: load GA script before head/custom

* style(config): googleAnalytics field empty by default

Co-authored-by: Jimmy Cai <github@jimmycai.com>
2021-02-11 18:56:39 +01:00
Jimmy CaiandGitHub a8718592df fix(utterances): set color scheme on load (#138)
* fix(utterances): set color scheme on load

Remove utterances.theme option from config.yaml

* fix(utterances): restore async tag
2021-02-11 18:46:23 +01:00
Jimmy CaiandGitHub 70cc14fcbe feat(list): display subsections in list style when there are no normal pages (#121)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/116
2021-01-07 11:28:16 +01:00
Jimmy CaiandGitHub 90e259f31e fix(colorScheme): dispatch onColorSchemeChange at page load (#118) 2021-01-04 10:52:14 +01:00
SOT-TECHandGitHub 1ec73b2d76 fix(i18n/ru): fix typo in 'notFound' (#114) 2021-01-03 22:42:08 +01:00
Daniel PessoaandGitHub 0de250c9ff feat(i18n): Improve Brazilian portuguese translation (#112) 2021-01-02 10:52:20 +01:00
Jimmy CaiandGitHub 84dd80959a fix: make Disqus / Utterances follow the global color scheme (#111)
* fix: make Disqus / Utterances follow the global color scheme

* fix: check if DISQUS exists before executing DISQUS.reset

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/107
2021-01-01 13:32:19 +01:00
Jimmy CaiandGitHub 2ee854dd6a fix(search): add missing i18n text (#110) 2021-01-01 13:24:26 +01:00
Jimmy CaiandGitHub ced387cbd5 Merge pull request #109 from CaiJimmy/refactor-widget
feat(widget): detect automatically path to archives / search page
2021-01-01 13:18:58 +01:00
Jimmy Cai efa3452cdb refactor(widget/archives): remove .widgets.archives.path config
The theme will automatically detect the permalink to the archives page.
2021-01-01 13:16:11 +01:00
Jimmy Cai 5ac2552e7c fix(widget/search): remove hardcoded form action 2021-01-01 13:12:23 +01:00
Jimmy CaiandGitHub ae477ab224 refactor(archives): remove archive.categories i18n item (#108)
It's possible in the future to display another kind of taxonomy.

To translate that title, create _index.md under  content/categories, with the following content:

---
title: Category
---
2021-01-01 13:04:37 +01:00
SOT-TECHandGitHub 3572fff280 feat(i18n): add Russian translation (#101) 2020-12-30 11:25:13 +01:00
zhixuanandGitHub 400b0a9283 feat(i18n): improve Japanese translation (#99) 2020-12-30 11:20:51 +01:00
zoxoyandGitHub bccb62cd46 feat: add bilibili shortcode (#97) 2020-12-30 09:28:22 +01:00
Jimmy Cai 0d645fe664 chore(style): update compiled scss 2020-12-28 10:51:00 +01:00
İsmail ÖzçelikandGitHub d790d42441 feat(i18n): add Turkish language file (#96) 2020-12-28 00:11:48 +01:00
Jimmy Cai 464f4b1d3b chore: release 2.0.1 2020-12-26 09:14:49 +01:00
Jimmy CaiandGitHub f2955aac27 refactor(article): improve category tag style (#94) 2020-12-25 09:59:02 +01:00
Jimmy CaiandGitHub a5820c6f52 fix(search): wrong permalink to page (#93)
- Show external image

closes https://github.com/CaiJimmy/hugo-theme-stack/issues/92
2020-12-25 09:39:04 +01:00
Jimmy CaiandGitHub 80be1b2435 fix(article): twitter_simple shortcode text color (#90)
closes https://github.com/CaiJimmy/hugo-theme-stack/issues/85
2020-12-24 11:24:26 +01:00
Jimmy CaiandGitHub 3326cf886a fix: dark mode toggle inconsistent positioning (#89) 2020-12-24 11:06:58 +01:00
Jimmy CaiandGitHub 39dd18e603 feat(math): add inline math support (#88) 2020-12-24 10:57:01 +01:00
Jimmy CaiandGitHub de79b8a470 fix(list): add missing object-fit property to compact list (#87) 2020-12-24 10:43:09 +01:00
40 changed files with 497 additions and 126 deletions
+42
View File
@@ -0,0 +1,42 @@
name: Build Hugo Artifact
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Hugo setup
uses: peaceiris/actions-hugo@v2.4.13
with:
# The Hugo version to download (if necessary) and use. Example: 0.58.2
hugo-version: latest # optional, default is latest
# Download (if necessary) and use Hugo extended version. Example: true
extended: true # optional, default is false
# Runs a set of commands using the runners shell
- name: Generate Hugo site
run: cd exampleSite && hugo --gc --themesDir ../..
- name: Upload Hugo artifact
uses: actions/upload-artifact@v2.2.2
with:
# Artifact name
name: resources
# A file, directory or wildcard pattern that describes what to upload
path: exampleSite/resources
+7
View File
@@ -0,0 +1,7 @@
---
title: "{{ replace .Name "-" " " | title }}"
image:
style:
background: "#2a9d8f"
color: "#fff"
---
+11 -2
View File
@@ -1,2 +1,11 @@
+++
+++
---
title: "{{ replace .Name "-" " " | title }}"
description:
date: {{ .Date }}
image:
math:
license:
hidden: false
comments: true
draft: true
---
+5
View File
@@ -0,0 +1,5 @@
---
title: "{{ replace .Name "-" " " | title }}"
description:
image:
---
+3 -5
View File
@@ -112,8 +112,6 @@ main.main {
padding-top: var(--main-top-padding);
}
.main-grid {
@media (max-width: $on-phone) {
flex-direction: column;
}
}
.main-container {
min-height: 100vh;
}
+4 -20
View File
@@ -56,24 +56,6 @@
padding: var(--card-padding);
}
.article-category {
margin-bottom: 10px;
a {
display: inline-block;
text-decoration: none;
padding: 8px 16px;
font-size: 1.4rem;
background: nth($defaultTagBackgrounds, 1);
color: nth($defaultTagColors, 1);
border-radius: var(--tag-border-radius);
@media (max-width: $on-phone) {
font-size: 1.25rem;
padding: 8px 14px;
}
}
}
.article-title {
font-weight: 600;
margin: 10px 0;
@@ -128,11 +110,12 @@
}
}
.article-category,
.article-tags {
a {
color: var(--accent-color-text);
background-color: var(--accent-color);
padding: 8px 18px;
padding: 8px 16px;
border-radius: var(--tag-border-radius);
display: inline-block;
font-size: 1.4rem;
@@ -193,6 +176,7 @@
img {
width: var(--image-size);
height: var(--image-size);
object-fit: cover;
}
}
@@ -200,7 +184,7 @@
font-size: 1.4rem;
}
.article-preview{
.article-preview {
font-size: 1.4rem;
color: var(--card-text-color-tertiary);
margin-top: 10px;
+1 -2
View File
@@ -14,8 +14,7 @@
/* Error */
.chroma .err {
color: #960050;
background-color: #1e0010
color: #bb0064;
}
/* LineTableTD */
@@ -15,7 +15,6 @@
/* Error */
.chroma .err {
color: #960050;
background-color: #1e0010
}
/* LineTableTD */
+4 -1
View File
@@ -244,7 +244,6 @@
padding: 2px 4px;
border-radius: var(--tag-border-radius);
font-family: var(--code-font-family);
word-wrap: break-word;
}
.gallery {
@@ -305,4 +304,8 @@
tr:nth-child(even) {
background-color: var(--tr-even-background-color);
}
.twitter-tweet {
color: var(--card-text-color-main);
}
}
+2 -2
View File
@@ -52,8 +52,8 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
--sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue";
--zh-font-family: "PingFang SC", "Hiragino Sans GB", "Droid Sans Fallback", "Microsoft YaHei";
--base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family);
--code-font-family: Menlo, Monaco, Consolas, "Courier New";
--base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family), sans-serif;
--code-font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
/*
+2
View File
@@ -9,6 +9,8 @@ class StackColorScheme {
this.bindMatchMedia();
this.currentScheme = this.getSavedScheme();
this.dispatchEvent(document.body.dataset.scheme as colorScheme);
if (toggleEl)
this.bindClick(toggleEl);
+38
View File
@@ -0,0 +1,38 @@
Vibrant:
- src: https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js
integrity: sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g=
type: script
PhotoSwipe:
- src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js
integrity: sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo=
type: script
defer: true
- src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js
integrity: sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU=
type: script
defer: true
- src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css
integrity: sha256-c0uckgykQ9v5k+IqViZOZKc47Jn7KQil4/MP3ySA3F8=
type: style
- src: https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.css
integrity: sha256-SBLU4vv6CA6lHsZ1XyTdhyjJxCjPif/TRkjnsyGAGnE=
type: style
KaTeX:
- src: https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css
integrity: sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X
type: style
- src: https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js
integrity: sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4
type: script
defer: true
- src: https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js
integrity: sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa
type: script
defer: true
+10 -3
View File
@@ -7,6 +7,9 @@ title: Example Site
# Change it to your Disqus shortname before using
disqusShortname: hugo-theme-stack
# GA Tracking ID
googleAnalytics:
# Theme i18n support
# Available values: en, fr, id, ja, ko, pt-br, zh-cn
DefaultContentLanguage: en
@@ -46,11 +49,16 @@ params:
comments:
enabled: true
provider: disqus
utterances:
repo:
issueTerm: pathname
label:
theme: preferred-color-scheme
remark42:
host:
site:
locale:
widgets:
enabled:
@@ -60,7 +68,6 @@ params:
archives:
limit: 5
path: archives
tagCloud:
limit: 10
@@ -82,7 +89,7 @@ params:
colorScheme:
# Display toggle
toggle: true
# Available values: auto, light, dark
default: auto
-4
View File
@@ -16,10 +16,6 @@ list:
one: Subsection
other: Subsections
archives:
categories:
other: Categories
article:
relatedContents:
other: Related contents
+11
View File
@@ -1,6 +1,9 @@
toggleMenu:
other: メニューを開く・閉じる
darkMode:
other: ダークモード
article:
relatedContents:
other: 関連するコンテンツ
@@ -22,3 +25,11 @@ widget:
tagCloud:
title:
other: タグ
search:
title:
other: サーチ
placeholder:
other: 入力...
resultTitle:
other: "#PAGES_COUNT 件 #TIME_SECONDS 秒)"
+14 -3
View File
@@ -1,9 +1,20 @@
toggleMenu:
other: Alternar Menu
archives:
categories:
other: Categorias
darkMode:
other: Modo Escuro
list:
page:
one: "{{ .Count }} página"
other: "{{ .Count }} páginas"
section:
other: Seção
subsection:
one: Subseção
other: Subseções
article:
relatedContents:
+57
View File
@@ -0,0 +1,57 @@
toggleMenu:
other: Показать/скрыть меню
darkMode:
other: Тёмный режим
list:
page:
one: "{{ .Count }} страница"
few: "{{ .Count }} страницы"
many: "{{ .Count }} страниц"
other: "{{ .Count }} страниц"
section:
other: Раздел
subsection:
one: Подраздел
few: Подразделы
many: Подразделы
other: Подразделы
article:
relatedContents:
other: Также рекомендуем
lastUpdatedOn:
other: Обновлено
notFound:
title:
other: Не найдено
subtitle:
other: Запрашиваемая страница не существует
widget:
archives:
title:
other: Архивы
more:
other: Ещё
tagCloud:
title:
other: Теги
search:
title:
other: Поиск
placeholder:
other: Введите что-нибудь...
resultTitle:
other: "Найдено #PAGES_COUNT страниц (за #TIME_SECONDS с.)"
footer:
builtWith:
other: Создано при помощи {{ .Generator }}
designedBy:
other: Тема {{ .Theme }}, дизайн {{ .DesignedBy }}
+53
View File
@@ -0,0 +1,53 @@
toggleMenu:
other: Menüyü Gizle
darkMode:
other: Koyu Mod
list:
page:
one: "{{ .Count }} makale"
other: "{{ .Count }} makale"
section:
other: Bölüm
subsection:
one: Alt bölüm
other: Alt bölümler
article:
relatedContents:
other: Alakalı içerikler
lastUpdatedOn:
other: Son güncelleme
notFound:
title:
other: Bulunamadı
subtitle:
other: Aradığınız sayfa mevcut değil.
widget:
archives:
title:
other: Arşiv
more:
other: Daha fazla
tagCloud:
title:
other: Etiketler
search:
title:
other: Arama
placeholder:
other: Birşeyler yazın...
resultTitle:
other: "#PAGES_COUNT sayfa (#TIME_SECONDS saniye)"
footer:
builtWith:
other: "{{ .Generator }} ile oluşturuldu."
designedBy:
other: "{{ .Theme }} teması {{ .DesignedBy }} tarafından tasarlandı"
-4
View File
@@ -4,10 +4,6 @@ toggleMenu:
darkMode:
other: 暗色模式
archives:
categories:
other: 分类
article:
relatedContents:
other: 相关文章
+1 -1
View File
@@ -1,5 +1,5 @@
{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- if $image -}}
{{- if and $image (ne (path.Ext .Destination) ".svg") -}}
{{- $alt := .PlainText | safeHTML -}}
<figure style="flex-grow: {{ div (mul $image.Width 100) $image.Height }}; flex-basis: {{ div (mul $image.Width 240) $image.Height }}px">
<a href="{{ $image.RelPermalink }}" data-size="{{ $image.Width }}x{{ $image.Height }}">
+5 -4
View File
@@ -1,11 +1,12 @@
{{ define "body-class" }}template-archives{{ end }}
{{ define "main" }}
{{ $categories := ($.Site.GetPage "taxonomyTerm" "categories").Pages }}
{{ if $categories }}
<h2 class="section-title">{{ T "archives.categories" }}</h2>
{{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}}
{{- $terms := $taxonomy.Pages -}}
{{ if $terms }}
<h2 class="section-title">{{ $taxonomy.Title }}</h2>
<div class="subsection-list">
<div class="article-list--tile">
{{ range $categories }}
{{ range $terms }}
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
{{ end }}
</div>
+1 -1
View File
@@ -6,7 +6,7 @@
</head>
<body class="{{ block `body-class` . }}{{ end }}">
{{- partial "head/colorScheme" . -}}
<div class="container flex on-phone--column {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }} {{ block `container-class` . }}{{end}}">
<div class="container main-container flex on-phone--column {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }} {{ block `container-class` . }}{{end}}">
{{ partial "sidebar/left.html" . }}
<main class="main full-width">
{{- block "main" . }}{{- end }}
+13 -4
View File
@@ -42,8 +42,17 @@
{{ end }}
</div>
{{ $subsections := .Sections }}
{{ with $subsections }}
{{- $subsections := .Sections -}}
{{- $pages := .Pages | complement $subsections -}}
{{- if eq (len $pages) 0 -}}
{{/* If there are no normal pages, display subsections in list style, with pagination */}}
{{/* This happens with taxonomies like categories or tags */}}
{{- $pages = $subsections -}}
{{- $subsections = slice -}}
{{- end -}}
{{- with $subsections -}}
<h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
<div class="subsection-list">
<div class="article-list--tile">
@@ -52,10 +61,10 @@
{{ end }}
</div>
</div>
{{ end }}
{{- end -}}
{{/* List only pages that are not a subsection */}}
{{ $paginator := .Paginate (.Pages | complement $subsections) }}
{{ $paginator := .Paginate $pages }}
<section class="article-list--compact">
{{ range $paginator.Pages }}
{{ partial "article-list/compact" . }}
+1 -1
View File
@@ -11,7 +11,7 @@
<input name="keyword" placeholder="{{ T `search.placeholder` }}" />
</p>
<button title="Search">
<button title="{{ T `search.title` }}">
{{ partial "helper/icon" "search" }}
</button>
</form>
+8 -6
View File
@@ -8,15 +8,17 @@
{{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}}
{{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}}
{{- if and $image.exists $image.resource -}}
{{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
{{- if $image.exists -}}
{{- $imagePermalink := "" -}}
{{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}}
{{- $thumbnail := $image.resource.Fill "120x120" -}}
{{- $image := dict "image" (absURL $thumbnail.Permalink) -}}
{{- $imagePermalink = (absURL $thumbnail.Permalink) -}}
{{- else -}}
{{- $image := dict "image" (absURL $image.resource.Permalink) -}}
{{- $imagePermalink = $image.permalink -}}
{{- end -}}
{{- $data = merge $data $image -}}
{{ end }}
{{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}}
{{- end -}}
{{- $result = $result | append $data -}}
{{- end -}}
+12 -8
View File
@@ -1,8 +1,12 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"
integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"
integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4"
crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"
integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
onload="renderMathInElement(document.querySelector(`.article-content`));"></script>
{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
<script>
window.addEventListener("DOMContentLoaded", () => {
renderMathInElement(document.querySelector(`.article-content`), {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
]
});})
</script>
@@ -65,8 +65,4 @@
</div>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.css">
{{- partial "helper/external" (dict "Context" . "Namespace" "PhotoSwipe") -}}
@@ -10,3 +10,13 @@
padding: var(--card-padding);
}
</style>
<script>
window.addEventListener('onColorSchemeChange', (e) => {
if (DISQUS) {
DISQUS.reset({
reload: true
});
}
})
</script>
@@ -0,0 +1,29 @@
{{- with .Site.Params.comments.remark42 -}}
<div id="remark42"></div>
<script>
var remark_config = {
host: "{{ .host }}",
site_id: '{{ .site }}',
components: ['embed'],
url: "{{ $.Permalink }}",
max_shown_comments: {{ default 15 .max_shown_comments }},
theme: document.body.dataset.scheme,
page_title: '{{ $.Title }}',
locale: '{{ default "en" .locale }}',
show_email_subscription: {{ default true .show_email_subscription }}
};
(function (c) {
for (var i = 0; i < c.length; i++) {
var d = document, s = d.createElement('script');
s.src = remark_config.host + '/web/' + c[i] + '.js';
s.defer = true;
(d.head || d.body).appendChild(s);
}
})(remark_config.components || ['embed']);
window.addEventListener('onColorSchemeChange', (e) => {
window.REMARK42.changeTheme(e.detail);
})
</script>
{{- end -}}
@@ -1,16 +1,40 @@
<script src="https://utteranc.es/client.js"
repo="{{ .Site.Params.comments.utterances.repo }}"
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
theme="{{ .Site.Params.comments.utterances.theme }}"
{{ with .Site.Params.comments.utterances.label }}
label="{{ . }}"
{{ end }}
crossorigin="anonymous"
async>
crossorigin="anonymous"
async
>
</script>
<style>
.utterances {
max-width: unset;
}
</style>
</style>
<script>
function setUtterancesTheme(theme) {
let utterances = document.querySelector('.utterances iframe');
if (utterances) {
utterances.contentWindow.postMessage(
{
type: 'set-theme',
theme: `github-${theme}`
},
'https://utteranc.es'
);
}
}
addEventListener('message', event => {
if (event.origin !== 'https://utteranc.es') return;
setUtterancesTheme(document.body.dataset.scheme)
});
window.addEventListener('onColorSchemeChange', (e) => {
setUtterancesTheme(e.detail)
})
</script>
@@ -1,5 +1,4 @@
<script src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js"
integrity="sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g=" crossorigin="anonymous"></script>
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
{{- $opts := dict "minify" hugo.IsProduction -}}
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- $ThemeVersion := "2.0.0" -}}
{{- $ThemeVersion := "2.2.0" -}}
<footer class="site-footer">
<section class="copyright">
&copy;
+2 -1
View File
@@ -21,4 +21,5 @@
<link rel="shortcut icon" href="{{ . }}" />
{{ end }}
{{- partial "head/custom.html" . -}}
{{- template "_internal/google_analytics_async.html" . -}}
{{- partial "head/custom.html" . -}}
+29
View File
@@ -0,0 +1,29 @@
{{- $List := index .Context.Site.Data.external .Namespace -}}
{{- with $List -}}
{{- range . -}}
{{- if eq .type "script" -}}
<script
src="{{ .src }}"
{{- with .integrity -}}
integrity="{{ . }}"
{{- end -}}
crossorigin="anonymous"
defer="{{ default false .defer }}"
>
</script>
{{- else if eq .type "style" -}}
<link
rel="stylesheet"
href="{{ .src }}"
{{- with .integrity -}}
integrity="{{ . }}"
{{- end -}}
crossorigin="anonymous"
>
{{- else -}}
{{- errorf "Error: unknown external resource type: %s" .type -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- errorf "Error: external resource '%s' is not found" .Namespace -}}
{{- end -}}
+5 -1
View File
@@ -16,7 +16,11 @@
{{ if $pageResourceImage }}
<!-- If image is found under page bundle -->
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
<!-- Disable SVG image processing, not supported by Hugo -->
{{ if ne (path.Ext $imageValue) ".svg" }}
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
{{ end }}
{{ else }}
<!-- Can not find the image under page bundle. Could be a relative linked image -->
{{ $result = merge $result (dict "permalink" $imageValue) }}
+32 -26
View File
@@ -1,27 +1,33 @@
<section class="widget archives">
<div class="widget-icon">
{{ partial "helper/icon" "infinity" }}
</div>
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
{{- $query := first 1 (where .Site.Pages "Layout" "==" "archives") -}}
{{- if $query -}}
{{- $archivesPage := index $query 0 -}}
<section class="widget archives">
<div class="widget-icon">
{{ partial "helper/icon" "infinity" }}
</div>
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $archives := $filtered.GroupByDate "2006" }}
<div class="widget-archive--list">
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
{{- $id := lower (replace $item.Key " " "-") -}}
<div class="archives-year">
<a href="{{ $.Site.Params.widgets.archives.path | relLangURL }}#{{ $id }}">
{{ if eq $index $.Site.Params.widgets.archives.limit }}
<span class="year">{{ T "widget.archives.more" }}</span>
{{ else }}
<span class="year">{{ .Key }}</span>
<span class="count">{{ len $item.Pages }}</span>
{{ end }}
</a>
</div>
{{ end }}
</div>
</section>
{{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $archives := $filtered.GroupByDate "2006" }}
<div class="widget-archive--list">
{{ range $index, $item := first (add .Site.Params.widgets.archives.limit 1) ($archives) }}
{{- $id := lower (replace $item.Key " " "-") -}}
<div class="archives-year">
<a href="{{ $archivesPage.RelPermalink }}#{{ $id }}">
{{ if eq $index $.Site.Params.widgets.archives.limit }}
<span class="year">{{ T "widget.archives.more" }}</span>
{{ else }}
<span class="year">{{ .Key }}</span>
<span class="count">{{ len $item.Pages }}</span>
{{ end }}
</a>
</div>
{{ end }}
</div>
</section>
{{- else -}}
{{- warnf "Archives page not found. Create a page with layout: archives." -}}
{{- end -}}
+16 -10
View File
@@ -1,10 +1,16 @@
<form action="/search" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}>
<p>
<label>{{ T "search.title" }}</label>
<input name="keyword" required placeholder="{{ T `search.placeholder` }}" />
<button title="Search">
{{ partial "helper/icon" "search" }}
</button>
</p>
</form>
{{- $query := first 1 (where .Site.Pages "Layout" "==" "search") -}}
{{- if $query -}}
{{- $searchPage := index $query 0 -}}
<form action="{{ $searchPage.RelPermalink }}" class="search-form widget" {{ with .OutputFormats.Get "json" -}}data-json="{{ .Permalink }}" {{- end }}>
<p>
<label>{{ T "search.title" }}</label>
<input name="keyword" required placeholder="{{ T `search.placeholder` }}" />
<button title="{{ T `search.title` }}">
{{ partial "helper/icon" "search" }}
</button>
</p>
</form>
{{- else -}}
{{- warnf "Search page not found. Create a page with layout: search." -}}
{{- end -}}
+24
View File
@@ -0,0 +1,24 @@
{{ $vid := (.Get 0) }}
{{ $videopage := default 1 (.Get 1) }}
{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }}
{{ $videoQuery := "" }}
{{ if strings.HasPrefix (lower $vid) "av" }}
{{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }}
{{ else if strings.HasPrefix (lower $vid) "bv" }}
{{ $videoQuery = querify "bvid" $vid }}
{{ else }}
<p>Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确</p>
<p>当前视频av或BV号:{{ $vid }},视频分P{{ $videopage }}</p>
{{ end }}
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
<iframe src="//player.bilibili.com/player.html?{{ $basicQuery | safeURL }}&{{ $videoQuery | safeURL }}"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"
>
</iframe>
</div>
+10
View File
@@ -0,0 +1,10 @@
{{ $vid := .Get 0 }}
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
<iframe src="http://v.qq.com/txp/iframe/player.html?vid={{ $vid }}&auto=0"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
style="position: absolute; width: 100%; height: 100%;">
</iframe>
</div>
File diff suppressed because one or more lines are too long