mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
Merge branch 'pr-125' into add-audio-tecentv
This commit is contained in:
commit
92ca052433
42
.github/workflows/hugo-artifact.yml
vendored
Normal file
42
.github/workflows/hugo-artifact.yml
vendored
Normal 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: resources
|
@ -14,8 +14,7 @@
|
|||||||
|
|
||||||
/* Error */
|
/* Error */
|
||||||
.chroma .err {
|
.chroma .err {
|
||||||
color: #960050;
|
color: #bb0064;
|
||||||
background-color: #1e0010
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LineTableTD */
|
/* LineTableTD */
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
/* Error */
|
/* Error */
|
||||||
.chroma .err {
|
.chroma .err {
|
||||||
color: #960050;
|
color: #960050;
|
||||||
background-color: #1e0010
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LineTableTD */
|
/* LineTableTD */
|
||||||
|
@ -244,7 +244,6 @@
|
|||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
border-radius: var(--tag-border-radius);
|
border-radius: var(--tag-border-radius);
|
||||||
font-family: var(--code-font-family);
|
font-family: var(--code-font-family);
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gallery {
|
.gallery {
|
||||||
|
@ -52,8 +52,8 @@ $defaultTagColors: #fff, #fff, #fff, #fff, #fff;
|
|||||||
--sys-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Droid Sans", "Helvetica Neue";
|
--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";
|
--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);
|
--base-font-family: "Lato", var(--sys-font-family), var(--zh-font-family), sans-serif;
|
||||||
--code-font-family: Menlo, Monaco, Consolas, "Courier New";
|
--code-font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
38
data/external.yaml
Normal file
38
data/external.yaml
Normal 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
|
@ -7,6 +7,9 @@ title: Example Site
|
|||||||
# Change it to your Disqus shortname before using
|
# Change it to your Disqus shortname before using
|
||||||
disqusShortname: hugo-theme-stack
|
disqusShortname: hugo-theme-stack
|
||||||
|
|
||||||
|
# GA Tracking ID
|
||||||
|
googleAnalytics:
|
||||||
|
|
||||||
# Theme i18n support
|
# Theme i18n support
|
||||||
# Available values: en, fr, id, ja, ko, pt-br, zh-cn
|
# Available values: en, fr, id, ja, ko, pt-br, zh-cn
|
||||||
DefaultContentLanguage: en
|
DefaultContentLanguage: en
|
||||||
@ -46,11 +49,12 @@ params:
|
|||||||
comments:
|
comments:
|
||||||
enabled: true
|
enabled: true
|
||||||
provider: disqus
|
provider: disqus
|
||||||
|
|
||||||
utterances:
|
utterances:
|
||||||
repo:
|
repo:
|
||||||
issueTerm: pathname
|
issueTerm: pathname
|
||||||
label:
|
label:
|
||||||
theme: preferred-color-scheme
|
|
||||||
remark42:
|
remark42:
|
||||||
host: # remark42服务端地址
|
host: # remark42服务端地址
|
||||||
site: # remark site id参数
|
site: # remark site id参数
|
||||||
|
@ -42,8 +42,17 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ $subsections := .Sections }}
|
{{- $subsections := .Sections -}}
|
||||||
{{ with $subsections }}
|
{{- $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>
|
<h2 class="section-title">{{ T "list.subsection" (len $subsections) }}</h2>
|
||||||
<div class="subsection-list">
|
<div class="subsection-list">
|
||||||
<div class="article-list--tile">
|
<div class="article-list--tile">
|
||||||
@ -52,10 +61,10 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
|
|
||||||
{{/* List only pages that are not a subsection */}}
|
{{/* List only pages that are not a subsection */}}
|
||||||
{{ $paginator := .Paginate (.Pages | complement $subsections) }}
|
{{ $paginator := .Paginate $pages }}
|
||||||
<section class="article-list--compact">
|
<section class="article-list--compact">
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
{{ partial "article-list/compact" . }}
|
{{ partial "article-list/compact" . }}
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"
|
{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
|
||||||
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="StackLaTeX()"></script>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function StackLaTeX() {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
renderMathInElement(document.querySelector(`.article-content`), {
|
renderMathInElement(document.querySelector(`.article-content`), {
|
||||||
delimiters: [
|
delimiters: [
|
||||||
{ left: "$$", right: "$$", display: true },
|
{ left: "$$", right: "$$", display: true },
|
||||||
@ -16,6 +8,5 @@
|
|||||||
{ left: "\\(", right: "\\)", display: false },
|
{ left: "\\(", right: "\\)", display: false },
|
||||||
{ left: "\\[", right: "\\]", display: true }
|
{ left: "\\[", right: "\\]", display: true }
|
||||||
]
|
]
|
||||||
});
|
});})
|
||||||
}
|
|
||||||
</script>
|
</script>
|
@ -65,8 +65,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
|
{{- partial "helper/external" (dict "Context" . "Namespace" "PhotoSwipe") -}}
|
||||||
<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">
|
|
@ -1,12 +1,12 @@
|
|||||||
<script src="https://utteranc.es/client.js"
|
<script src="https://utteranc.es/client.js"
|
||||||
repo="{{ .Site.Params.comments.utterances.repo }}"
|
repo="{{ .Site.Params.comments.utterances.repo }}"
|
||||||
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
|
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
|
||||||
theme="{{ .Site.Params.comments.utterances.theme }}"
|
|
||||||
{{ with .Site.Params.comments.utterances.label }}
|
{{ with .Site.Params.comments.utterances.label }}
|
||||||
label="{{ . }}"
|
label="{{ . }}"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
async>
|
async
|
||||||
|
>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@ -16,16 +16,25 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('onColorSchemeChange', (e) => {
|
function setUtterancesTheme(theme) {
|
||||||
let utterances = document.querySelector('.utterances iframe');
|
let utterances = document.querySelector('.utterances iframe');
|
||||||
if (utterances) {
|
if (utterances) {
|
||||||
utterances.contentWindow.postMessage(
|
utterances.contentWindow.postMessage(
|
||||||
{
|
{
|
||||||
type: 'set-theme',
|
type: 'set-theme',
|
||||||
theme: `github-${e.detail}`
|
theme: `github-${theme}`
|
||||||
},
|
},
|
||||||
'https://utteranc.es'
|
'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>
|
</script>
|
@ -1,5 +1,4 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js"
|
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
|
||||||
integrity="sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g=" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
{{- $opts := dict "minify" hugo.IsProduction -}}
|
{{- $opts := dict "minify" hugo.IsProduction -}}
|
||||||
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
|
{{- $script := resources.Get "ts/main.ts" | js.Build $opts -}}
|
||||||
|
@ -21,4 +21,5 @@
|
|||||||
<link rel="shortcut icon" href="{{ . }}" />
|
<link rel="shortcut icon" href="{{ . }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{- partial "head/custom.html" . -}}
|
{{- template "_internal/google_analytics_async.html" . -}}
|
||||||
|
{{- partial "head/custom.html" . -}}
|
||||||
|
29
layouts/partials/helper/external.html
Normal file
29
layouts/partials/helper/external.html
Normal 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 -}}
|
Loading…
Reference in New Issue
Block a user