setup
This commit is contained in:
0
themes/hugo-theme-monochrome/layouts/404.html
Normal file
0
themes/hugo-theme-monochrome/layouts/404.html
Normal file
46
themes/hugo-theme-monochrome/layouts/_default/baseof.html
Normal file
46
themes/hugo-theme-monochrome/layouts/_default/baseof.html
Normal file
@@ -0,0 +1,46 @@
|
||||
{{ .Scratch.SetInMap "params" "syntax_highlight" (.Site.Params.syntax_highlight | default (dict "lib" "builtin" "builtin" (dict "enable_code_copy" true))) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_site_search" (.Site.Params.enable_site_search | default false) }}
|
||||
{{ .Scratch.SetInMap "params" "search_hidden" (.Params.search_hidden | default false) }}
|
||||
{{ .Scratch.SetInMap "params" "navbar_title" (.Params.navbar_title | default .Site.Params.navbar_title | default .Site.Title) }}
|
||||
{{ .Scratch.SetInMap "params" "author" (.Params.author | default .Site.Params.author) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_open_graph" (.Params.open_graph | default .Site.Params.enable_open_graph | default true) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_twitter_cards" (.Params.twitter_cards | default .Site.Params.enable_twitter_cards | default true) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_toc" (.Params.toc | default .Site.Params.enable_toc | default true) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_zooming_js" (.Params.zooming_js | default .Site.Params.enable_zooming_js | default true) }}
|
||||
{{ .Scratch.SetInMap "params" "ga_code" (.Params.ga | default .Site.GoogleAnalytics) }}
|
||||
{{ .Scratch.SetInMap "params" "footer" (.Params.footer | default .Site.Params.footer) }}
|
||||
{{ .Scratch.SetInMap "params" "math" (.Params.math | default .Site.Params.enable_math | default false) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_collapsible_toc" (.Params.collapsible_toc | default .Site.Params.enable_collapsible_toc | default false) }}
|
||||
{{ .Scratch.SetInMap "params" "enable_collapsible_changelogs" (.Params.collapsible_changelogs | default .Site.Params.enable_collapsible_changelogs | default false) }}
|
||||
{{ .Scratch.SetInMap "params" "color_scheme" (.Site.Params.color_scheme | default "light") }}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang='{{ .Site.LanguageCode }}'>
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
<main>
|
||||
{{- partial "header.html" . -}}
|
||||
{{- partial "nav.html" . -}}
|
||||
{{- partial "sidebar.html" . -}}
|
||||
<div id="content" class="content-margin">
|
||||
{{ if .Params.changelogs }}
|
||||
{{ $enable_collapsible_changelogs := (.Scratch.Get "params").enable_collapsible_changelogs }}
|
||||
{{ partial "collapsible-menu.html" (dict "type" "changelogs" "context" . "enable" $enable_collapsible_changelogs) }}
|
||||
{{ end }}
|
||||
|
||||
{{- block "content" . }}{{- end }}
|
||||
|
||||
{{ if eq .Kind "page" }}
|
||||
{{ if (.Params.disqus | default .Site.DisqusShortname) }}
|
||||
{{- partial "disqus.html" . -}}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ if (.Params.disqus | default false) }}
|
||||
{{- partial "disqus.html" . -}}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- partial "footer.html" . -}}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
7
themes/hugo-theme-monochrome/layouts/_default/index.json
Normal file
7
themes/hugo-theme-monochrome/layouts/_default/index.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{{- $index := slice -}}
|
||||
{{- range .Site.RegularPages -}}
|
||||
{{ if not (.Scratch.Get "params").search_hidden }}
|
||||
{{- $index = $index | append (dict "title" .Title "content" .Plain "permalink" .Permalink) -}}
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{- $index | jsonify -}}
|
||||
41
themes/hugo-theme-monochrome/layouts/_default/list.html
Normal file
41
themes/hugo-theme-monochrome/layouts/_default/list.html
Normal file
@@ -0,0 +1,41 @@
|
||||
{{ define "content" }}
|
||||
|
||||
{{ if and .Content (eq .Paginator.PageNumber 1) }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{- $group_by_year := .Params.group_by_year | default .Site.Params.list_layout.enable_group_by_year | default true -}}
|
||||
{{- $show_date := .Params.show_date | default .Site.Params.list_layout.enable_show_date | default true -}}
|
||||
{{- $pagination := .Params.pagination | default .Site.Params.list_layout.enable_pagination | default false -}}
|
||||
|
||||
{{- $pages := .Pages -}}
|
||||
{{- if and $pagination $group_by_year -}}
|
||||
{{ $pages = (.Paginate (.Pages.GroupByPublishDate "2006")).PageGroups }}
|
||||
{{- else if and $pagination (not $group_by_year) -}}
|
||||
{{ $pages = .Paginator.Pages }}
|
||||
{{- else if and (not $pagination) $group_by_year -}}
|
||||
{{ $pages = .Pages.GroupByPublishDate "2006" }}
|
||||
{{- end -}}
|
||||
|
||||
{{ if $group_by_year }}
|
||||
{{ range $pages }}
|
||||
<div class="content-margin">
|
||||
<h1>{{- .Key -}}</h1>
|
||||
{{- partial "list.html" (dict "pages" .Pages "show_date" $show_date "group_by_year" $group_by_year) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if $pagination }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<div class="content-margin">
|
||||
{{- partial "list.html" (dict "pages" $pages "show_date" $show_date "group_by_year" $group_by_year) -}}
|
||||
</div>
|
||||
{{ if $pagination }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
39
themes/hugo-theme-monochrome/layouts/_default/rss.xml
Normal file
39
themes/hugo-theme-monochrome/layouts/_default/rss.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end -}}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | html }}</description>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
</rss>
|
||||
14
themes/hugo-theme-monochrome/layouts/_default/single.html
Normal file
14
themes/hugo-theme-monochrome/layouts/_default/single.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- define "content" -}}
|
||||
|
||||
{{ if and (ne .TableOfContents "<nav id=\"TableOfContents\"></nav>") (.Scratch.Get "params").enable_toc }}
|
||||
{{ $enable_collapsible_toc := (.Scratch.Get "params").enable_collapsible_toc }}
|
||||
{{ partial "collapsible-menu.html" (dict "type" "toc" "context" . "enable" $enable_collapsible_toc) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Content }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{- end -}}
|
||||
10
themes/hugo-theme-monochrome/layouts/_default/taxonomy.html
Normal file
10
themes/hugo-theme-monochrome/layouts/_default/taxonomy.html
Normal file
@@ -0,0 +1,10 @@
|
||||
{{- define "content" -}}
|
||||
|
||||
<div class="content-margin">
|
||||
<h1>{{ .Title }}</h1>
|
||||
<div>
|
||||
{{- partial "terms-cloud.html" .Data.Terms.Alphabetical -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{- end -}}
|
||||
49
themes/hugo-theme-monochrome/layouts/_default/term.html
Normal file
49
themes/hugo-theme-monochrome/layouts/_default/term.html
Normal file
@@ -0,0 +1,49 @@
|
||||
{{- define "content" -}}
|
||||
|
||||
{{- $group_by_year := .Site.Params.list_layout.enable_group_by_year | default true -}}
|
||||
{{- $show_date := .Site.Params.list_layout.enable_show_date | default true -}}
|
||||
{{- $pagination := .Site.Params.list_layout.enable_pagination | default false -}}
|
||||
|
||||
{{- $pages := .Pages -}}
|
||||
{{- if and $pagination $group_by_year -}}
|
||||
{{ $pages = (.Paginate (.Pages.GroupByPublishDate "2006")).PageGroups }}
|
||||
{{- else if and $pagination (not $group_by_year) -}}
|
||||
{{ $pages = .Paginator.Pages }}
|
||||
{{- else if and (not $pagination) $group_by_year -}}
|
||||
{{ $pages = .Pages.GroupByPublishDate "2006" }}
|
||||
{{- end -}}
|
||||
|
||||
<div>
|
||||
<div class="term-title">
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ range .AlternativeOutputFormats -}}
|
||||
{{ if eq .MediaType.Type "application/rss+xml" }}
|
||||
<div class="icon">
|
||||
<a rel="noopener" target="_blank" href="{{ .Permalink | safeURL }}">
|
||||
{{ partial "svg/feather.html" "rss" }}
|
||||
</a>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ end -}}
|
||||
</div>
|
||||
{{ if $group_by_year }}
|
||||
{{ range $pages }}
|
||||
<div class="content-margin">
|
||||
<h1>{{- .Key -}}</h1>
|
||||
{{- partial "list.html" (dict "pages" .Pages "show_date" $show_date "group_by_year" $group_by_year) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if $pagination }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<div class="content-margin">
|
||||
{{- partial "list.html" (dict "pages" $pages "show_date" $show_date "group_by_year" $group_by_year) -}}
|
||||
</div>
|
||||
{{ if $pagination }}
|
||||
{{ template "_internal/pagination.html" . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{- end -}}
|
||||
3
themes/hugo-theme-monochrome/layouts/balloon/list.html
Normal file
3
themes/hugo-theme-monochrome/layouts/balloon/list.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "content" }}
|
||||
{{ partial "balloon/layout.html" . }}
|
||||
{{ end }}
|
||||
3
themes/hugo-theme-monochrome/layouts/balloon/single.html
Normal file
3
themes/hugo-theme-monochrome/layouts/balloon/single.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "content" }}
|
||||
{{- partial "balloon/layout.html" . -}}
|
||||
{{ end }}
|
||||
9
themes/hugo-theme-monochrome/layouts/blank/list.html
Normal file
9
themes/hugo-theme-monochrome/layouts/blank/list.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{- define "content" -}}
|
||||
|
||||
{{ if .Content }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{- end -}}
|
||||
17
themes/hugo-theme-monochrome/layouts/bookcase/list.html
Normal file
17
themes/hugo-theme-monochrome/layouts/bookcase/list.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{{ define "content" }}
|
||||
|
||||
{{ $list_sections := .Params.bookcase_list_sections | default true }}
|
||||
{{ $list_pages := .Params.bookcase_list_pages | default true }}
|
||||
|
||||
{{ $res := default nil }}
|
||||
{{ if and $list_sections $list_pages }}
|
||||
{{ $res = .Pages }}
|
||||
{{ else if $list_sections }}
|
||||
{{ $res = .Sections }}
|
||||
{{ else if $list_pages }}
|
||||
{{ $res = .RegularPages }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "bookcase/layout.html" (dict "ctx" . "title" .Title "content" .Content "res" $res) }}
|
||||
|
||||
{{ end }}
|
||||
3
themes/hugo-theme-monochrome/layouts/gallery/list.html
Normal file
3
themes/hugo-theme-monochrome/layouts/gallery/list.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "content" }}
|
||||
{{ partial "gallery/layout.html" . }}
|
||||
{{ end }}
|
||||
3
themes/hugo-theme-monochrome/layouts/gallery/single.html
Normal file
3
themes/hugo-theme-monochrome/layouts/gallery/single.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{{ define "content" }}
|
||||
{{- partial "gallery/layout.html" . -}}
|
||||
{{ end }}
|
||||
11
themes/hugo-theme-monochrome/layouts/home.html
Normal file
11
themes/hugo-theme-monochrome/layouts/home.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ define "content" }}
|
||||
|
||||
{{ if .Content }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "postcard/layout.html" (dict "pages" .Site.RegularPages "ctx" .) }}
|
||||
|
||||
{{ end }}
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class="balloon-card-item">
|
||||
<div class="balloon-card-item-line">
|
||||
{{ partial "balloon/line.html" false }}
|
||||
{{ partial "balloon/dot.html" }}
|
||||
{{ partial "balloon/line.html" .last_item }}
|
||||
</div>
|
||||
|
||||
<div class="balloon-card-item-content">
|
||||
{{- partial "content.html" (dict "ctx" .ctx "content" .ctx.Content) -}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
<div class="balloon-dot"></div>
|
||||
@@ -0,0 +1,29 @@
|
||||
{{ $img := .Params.balloon_img_src | default .Params.balloon_img_src_dark }}
|
||||
{{ $img_dark := .Params.balloon_img_src_dark | default .Params.balloon_img_src }}
|
||||
{{ $balloon_circle := .Params.balloon_circle | default true }}
|
||||
|
||||
<div class="balloon-head-item">
|
||||
{{/* For desktop layout */}}
|
||||
<div class="balloon-head-item-desktop">
|
||||
<div class="balloon-head-item-img-light">
|
||||
{{ partial "balloon/head/desktop.html" (dict "img" $img "balloon_circle" $balloon_circle) }}
|
||||
</div>
|
||||
<div class="balloon-head-item-img-dark">
|
||||
{{ partial "balloon/head/desktop.html" (dict "img" $img_dark "balloon_circle" $balloon_circle ) }}
|
||||
</div>
|
||||
{{ partial "balloon/line.html" false }}
|
||||
</div>
|
||||
{{/* For mobile layout */}}
|
||||
<div class="balloon-head-item-mobile">
|
||||
<div class="balloon-head-item-img-light">
|
||||
{{ partial "balloon/head/mobile.html" (dict "img" $img "balloon_circle" $balloon_circle) }}
|
||||
</div>
|
||||
<div class="balloon-head-item-img-dark">
|
||||
{{ partial "balloon/head/mobile.html" (dict "img" $img_dark "balloon_circle" $balloon_circle ) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="balloon-head-item-content">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
{{ if .img }}
|
||||
<div class="balloon-head-item-img">
|
||||
<img alt="balloon_head" src='{{- .img | absURL -}}' {{ if .balloon_circle }}class="rounded"{{ end }}>
|
||||
</div>
|
||||
{{ else }}
|
||||
{{ partial "balloon/dot.html" }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{ if .img }}
|
||||
<div class="balloon-head-item-img">
|
||||
<img alt="balloon_head" src='{{- .img | absURL -}}' {{ if .balloon_circle }}class="rounded"{{ end }}>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,21 @@
|
||||
{{ if .Params.balloon_resources }}
|
||||
<div class="balloon-layout">
|
||||
{{ partial "balloon/head-item.html" . }}
|
||||
|
||||
{{ $res := .Site.GetPage .Params.balloon_resources }}
|
||||
{{ $pages := $res.Resources.ByType "page" }}
|
||||
|
||||
{{ if $pages }}
|
||||
{{ $max_idx := sub (len $pages) 1 }}
|
||||
|
||||
{{ range $index, $value := (sort $pages "Params.weight" "asc") }}
|
||||
{{ partial "balloon/title-item.html" . }}
|
||||
{{ partial "balloon/card-item.html" (dict "ctx" . "last_item" (eq $index $max_idx)) }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<span>{{ i18n "no_page_under_resouces" (dict "resources_name" "balloon_resources" "resources_path" .Params.balloon_resources ) }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<span>{{ i18n "resources_not_found" (dict "resources_name" "balloon_resources")}}</span>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,6 @@
|
||||
{{ $last_item := . }}
|
||||
<div class="balloon-line-container">
|
||||
{{ if not $last_item }}
|
||||
<div class="balloon-line" style="width: 2px"></div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,6 @@
|
||||
<div class="balloon-title-item">
|
||||
<div class="balloon-title-item-line">
|
||||
{{ partial "balloon/line.html" false }}
|
||||
</div>
|
||||
<h5 class="balloon-title-item-content">{{ .Title }}</h5>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
{{ $cover_src := .Params.bookcase_cover_src | default .Params.bookcase_cover_src_dark }}
|
||||
{{ $cover_src_dark := .Params.bookcase_cover_src_dark | default .Params.bookcase_cover_src }}
|
||||
{{ $cover_title := .Params.bookcase_cover_title | default .Title }}
|
||||
|
||||
<div class="bookcase-item">
|
||||
<figure>
|
||||
<img src="{{ $cover_src | absURL }}" class="bookcase-item-img-light">
|
||||
<img src="{{ $cover_src_dark | absURL }}" class="bookcase-item-img-dark">
|
||||
<a href="{{ .RelPermalink }}" class="bookcase-item-overlay"></a>
|
||||
</figure>
|
||||
<figcaption>
|
||||
<a href="{{ .RelPermalink }}">{{ $cover_title }}</a>
|
||||
</figcaption>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
{{ $ctx := .ctx }}
|
||||
{{ $title := .title }}
|
||||
{{ $content := .content }}
|
||||
{{ $res := .res }}
|
||||
|
||||
<div class="content-margin">
|
||||
<div class="my-8">
|
||||
<h1>{{ $title }}</h1>
|
||||
{{ if $content }}
|
||||
{{- partial "content.html" (dict "ctx" $ctx "content" $content) -}}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ with $res }}
|
||||
<div class="bookcase-layout content-margin">
|
||||
{{ range . }}
|
||||
{{ $hidden := .Params.bookcase_hidden | default false }}
|
||||
{{ if not $hidden -}}
|
||||
{{- partial "bookcase/item.html" . -}}
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,39 @@
|
||||
{{- if .enable -}}
|
||||
<details class="collapsible-menu-wrapper">
|
||||
{{- else -}}
|
||||
<div class="collapsible-menu-wrapper">
|
||||
{{- end -}}
|
||||
|
||||
{{- if .enable -}}
|
||||
<summary class="collapsible-menu-type">
|
||||
{{- else -}}
|
||||
<div class="collapsible-menu-type">
|
||||
{{- end -}}
|
||||
<span>{{ i18n .type }}</span>
|
||||
{{- if .enable -}}
|
||||
</summary>
|
||||
{{- else -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<div class="collapsible-menu">
|
||||
{{ if eq .type "changelogs" }}
|
||||
<article id="collapsible_menu_changelogs">
|
||||
{{ range $log := .context.Params.changelogs }}
|
||||
<div>{{ $log.tag | markdownify }}</div>
|
||||
<div>
|
||||
{{ range $log.description }}
|
||||
<div>{{ . | markdownify }}</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</article>
|
||||
{{ else if eq .type "toc" }}
|
||||
{{ .context.TableOfContents }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{- if .enable -}}
|
||||
</details>
|
||||
{{- else -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
12
themes/hugo-theme-monochrome/layouts/partials/content.html
Normal file
12
themes/hugo-theme-monochrome/layouts/partials/content.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ $ctx := .ctx }}
|
||||
{{ $content := .content }}
|
||||
{{ $enable_line_no := ($ctx.Scratch.Get "params").syntax_highlight.prism.enable_line_no | default true }}
|
||||
|
||||
<article {{ if $enable_line_no }}class="line-numbers"{{ end }}>
|
||||
{{ $content := $content | replaceRE "<table>" "<table class=\"mc-table\">" }}
|
||||
{{ if eq ($ctx.Scratch.Get "params").syntax_highlight.lib "prism.js" }}
|
||||
{{ $content = $content | replaceRE "<pre>" "<pre class=\"language-text\">" }}
|
||||
{{ $content = $content | replaceRE "<pre([^>]*)class=\"([^>]*)\"([^>]*)>" "<pre$1 class=\"mc-prism hide $2\" $3>" }}
|
||||
{{ end }}
|
||||
{{ $content | safeHTML }}
|
||||
</article>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="content-margin">
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
{{ with (.Scratch.Get "params").footer }}
|
||||
<footer>
|
||||
<article>
|
||||
{{- . | safeHTML -}}
|
||||
</article>
|
||||
</footer>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,65 @@
|
||||
{{ if .Content }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.gallery_resources }}
|
||||
{{ $res := .Site.GetPage .Params.gallery_resources }}
|
||||
{{ $pages := $res.Resources.ByType "page" }}
|
||||
|
||||
{{ if $pages }}
|
||||
<div class="content-margin gallery-layout">
|
||||
{{ $max_idx := sub (len $pages) 1 }}
|
||||
|
||||
{{ range $index, $value := (sort $pages "Params.weight" "asc") }}
|
||||
<div class="gallery-item">
|
||||
{{ $title_link := .Params.gallery_title_link }}
|
||||
{{ $img_link := .Params.gallery_img_link }}
|
||||
|
||||
{{ if .Params.gallery_img_src }}
|
||||
<figure>
|
||||
{{ if $img_link }}<a target="_blank" rel="noopener" href="{{ $img_link }}">{{ end }}
|
||||
<img src="{{ .Params.gallery_img_src | absURL }}" alt="{{ .Title }}">
|
||||
{{ if $img_link }}</a>{{ end }}
|
||||
{{ with .Params.gallery_img_caption }}
|
||||
<figcaption>
|
||||
<article>
|
||||
{{ . | safeHTML }}
|
||||
</article>
|
||||
</figcaption>
|
||||
{{ end }}
|
||||
</figure>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Title }}
|
||||
<div class="gallery-item-title">
|
||||
{{ if $title_link }}<a target="_blank" rel="noopener" href="{{ $title_link }}">{{ end }}
|
||||
<span>{{- .Title -}}</span>
|
||||
{{ if $title_link }}</a>{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Content }}
|
||||
<div class="gallery-item-content">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.gallery_statistic }}
|
||||
<article class="gallery-item-statistic">
|
||||
{{ range $stat := .Params.gallery_statistic }}
|
||||
<div>{{ $stat.key | markdownify }}</div>
|
||||
<div>{{ $stat.value | markdownify }}</div>
|
||||
{{ end }}
|
||||
</article>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<span>{{ i18n "no_page_under_resouces" (dict "resources_name" "gallery_resources" "resources_path" .Params.gallery_resources ) }}</span>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<span>{{ i18n "resources_not_found" (dict "resources_name" "gallery_resources")}}</span>
|
||||
{{ end }}
|
||||
64
themes/hugo-theme-monochrome/layouts/partials/head.html
Normal file
64
themes/hugo-theme-monochrome/layouts/partials/head.html
Normal file
@@ -0,0 +1,64 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="shortcut icon" href='{{ "favicon.ico" | absURL }}' type="image/x-icon">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>
|
||||
{{- if eq .Kind "home" -}}
|
||||
{{- print .Site.Title -}}
|
||||
{{- else if eq .Kind "section" -}}
|
||||
{{- print .CurrentSection.Title " - " .Site.Title }}
|
||||
{{- else -}}
|
||||
{{- print .Title " - " .Site.Title -}}
|
||||
{{- end -}}
|
||||
</title>
|
||||
|
||||
{{ with .Description }}
|
||||
<meta name="description" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ with .Keywords }}
|
||||
<meta name="keywords" content="{{ delimit . "," }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ with (.Scratch.Get "params").author }}
|
||||
<meta name="author" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{ if (.Scratch.Get "params").enable_open_graph }}
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if (.Scratch.Get "params").enable_twitter_cards }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{- partial "resources/css.html" . -}}
|
||||
|
||||
{{ if (.Scratch.Get "params").ga_code }}
|
||||
{{ template "_internal/google_analytics.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{/* Dark theme: inline in `head` to avoid FOUC */}}
|
||||
<script>
|
||||
if (!('theme' in localStorage)) {
|
||||
{{ $color_scheme := (.Scratch.Get "params").color_scheme -}}
|
||||
{{- if eq $color_scheme "light" -}}
|
||||
localStorage.theme = 'light';
|
||||
{{- else if eq $color_scheme "dark" -}}
|
||||
localStorage.theme = 'dark';
|
||||
{{- end }}
|
||||
}
|
||||
|
||||
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.setAttribute("data-theme", "dark");
|
||||
} else {
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
</script>
|
||||
|
||||
{{- partial "resources/js.html" . -}}
|
||||
|
||||
{{ if fileExists "/static/user.css" -}}
|
||||
<link rel="stylesheet" href="{{ urls.JoinPath .Site.BaseURL "user.css" }}">
|
||||
{{- end }}
|
||||
</head>
|
||||
59
themes/hugo-theme-monochrome/layouts/partials/header.html
Normal file
59
themes/hugo-theme-monochrome/layouts/partials/header.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<header>
|
||||
<div class="brand">
|
||||
<div id="sidebar_btn">
|
||||
<svg id="menu_icon" width="26px" height="26px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "menu" -}}
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a href="{{ .Site.Home.RelPermalink }}">
|
||||
{{- with (.Scratch.Get "params").navbar_title }}
|
||||
{{- . | safeHTML -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toolbox">
|
||||
<div id="theme_tool">
|
||||
<svg id="dark_mode_btn" class="toolbox-btn" width="18px" height="18px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "sun" -}}
|
||||
</svg>
|
||||
<svg id="light_mode_btn" class="toolbox-btn" width="18px" height="18px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "moon" -}}
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
{{ if (.Scratch.Get "params").enable_site_search }}
|
||||
<div id="search_tool">
|
||||
<svg id="search_btn" class="toolbox-btn" width="18px" height="18px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "search" -}}
|
||||
</svg>
|
||||
{{- partial "search-menu.html" -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.IsMultiLingual }}
|
||||
<div id="translation_tool" class="dropdown-wrapper pure-menu pure-menu-horizontal toolbox-btn">
|
||||
<ul class="pure-menu-list">
|
||||
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
|
||||
<div class="dropdown-btn pure-menu-link">
|
||||
<svg width="18px" height="18px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "globe" -}}
|
||||
</svg>
|
||||
<span class="dropdown-desc">{{ .Site.Language.LanguageName }}</span>
|
||||
</div>
|
||||
<ul class="pure-menu-children">
|
||||
{{ range .Site.Home.AllTranslations }}
|
||||
<li class="pure-menu-item">
|
||||
<a href="{{ .Permalink }}" class="pure-menu-link">{{ .Language.LanguageName }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
</header>
|
||||
27
themes/hugo-theme-monochrome/layouts/partials/list.html
Normal file
27
themes/hugo-theme-monochrome/layouts/partials/list.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{{ $show_date := .show_date | default true }}
|
||||
{{ $pages := .pages }}
|
||||
{{ $group_by_year := .group_by_year | default true }}
|
||||
|
||||
{{- if $pages -}}
|
||||
{{- if $show_date -}}
|
||||
{{- $pages = $pages.ByPublishDate.Reverse -}}
|
||||
{{- end -}}
|
||||
<ul class="list-layout">
|
||||
{{ range $pages }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
{{ if $show_date }}
|
||||
<span>
|
||||
{{ if $group_by_year }}
|
||||
{{- .PublishDate.Format "01/02" -}}
|
||||
{{ else }}
|
||||
{{- .PublishDate.Format "2006/01/02" -}}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
38
themes/hugo-theme-monochrome/layouts/partials/nav.html
Normal file
38
themes/hugo-theme-monochrome/layouts/partials/nav.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<nav id="navbar" class="pure-menu">
|
||||
{{- $currentPage := . -}}
|
||||
{{- $currentUrl := .RelPermalink -}}
|
||||
{{- $baseURL := .Site.BaseURL }}
|
||||
<ul class="pure-menu-list">
|
||||
{{- range .Site.Menus.navbar -}}
|
||||
{{ $navbar_decoration := "" }}
|
||||
{{- if $currentPage.IsMenuCurrent "navbar" . -}}
|
||||
{{ $navbar_decoration = "active" }}
|
||||
{{- else if eq $currentUrl .URL -}}
|
||||
{{ $navbar_decoration = "active" }}
|
||||
{{- else if and (in ($currentUrl|lower) (.URL|lower)) (ne (relURL .URL) (relURL $baseURL)) -}}
|
||||
{{ $navbar_decoration = "insection" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Children -}}
|
||||
<li class="navbar-item navbar-dropdown pure-menu-item pure-menu-has-children pure-menu-allow-hover {{ $navbar_decoration }}">
|
||||
{{ if .URL }}
|
||||
<a href="{{ .URL }}" class="pure-menu-link">{{- .Name -}}</a>
|
||||
{{ else }}
|
||||
<div class="pure-menu-link">{{- .Name -}}</div>
|
||||
{{ end }}
|
||||
<ul class="pure-menu-children">
|
||||
{{- partial "navbar/nested-desktop.html" . -}}
|
||||
</ul>
|
||||
</li>
|
||||
{{- else -}}
|
||||
<li class="navbar-item pure-menu-item {{ $navbar_decoration }}">
|
||||
{{ if .URL }}
|
||||
<a href="{{ .URL }}" class="pure-menu-link">{{- .Name -}}</a>
|
||||
{{ else }}
|
||||
<div class="pure-menu-link">{{- .Name -}}</div>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,22 @@
|
||||
{{ range .Children }}
|
||||
{{ if .Children }}
|
||||
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
|
||||
{{ if .URL }}
|
||||
<a href="{{ .URL }}" class="pure-menu-link">{{- .Name -}}</a>
|
||||
{{ else }}
|
||||
<div class="pure-menu-link">{{- .Name -}}</div>
|
||||
{{ end }}
|
||||
<ul class="pure-menu-children">
|
||||
{{- partial "navbar/nested-desktop.html" . -}}
|
||||
</ul>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li class="pure-menu-item">
|
||||
{{ if .URL }}
|
||||
<a href="{{ .URL }}" class="pure-menu-link">{{- .Name -}}</a>
|
||||
{{ else }}
|
||||
<div class="pure-menu-link">{{- .Name -}}</div>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
{{ with .Children }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
{{ if .Children }}
|
||||
<li>
|
||||
<details>
|
||||
<summary>
|
||||
{{ if .URL }}
|
||||
<span><a href="{{ .URL }}">{{- .Name -}}</a></span>
|
||||
{{ else }}
|
||||
<span>{{- .Name -}}</span>
|
||||
{{ end }}
|
||||
</summary>
|
||||
{{- partial "navbar/nested-mobile.html" . -}}
|
||||
</details>
|
||||
</li>
|
||||
{{ else }}
|
||||
<li>
|
||||
{{ if .URL }}
|
||||
<a href="{{ .URL }}">{{- .Name -}}</a>
|
||||
{{ else }}
|
||||
<div>{{- .Name -}}</div>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,38 @@
|
||||
{{ $ctx := .ctx }}
|
||||
{{ $pages := .pages }}
|
||||
|
||||
<div class="postcard-layout content-margin">
|
||||
{{ range ($ctx.Paginator).Pages }}
|
||||
<a href="{{ .Permalink }}">
|
||||
<div class="postcard-item">
|
||||
<div class="postcard-title">
|
||||
<span>{{ .Title }}</span>
|
||||
</div>
|
||||
<div class="postcard-summary">
|
||||
<span>{{ .Summary | plainify }}</span>
|
||||
</div>
|
||||
<div class="postcard-metadata">
|
||||
<span>{{ .Date.Format "2006/01/02" }} · {{ template "breadcrumbtext" (dict "p1" .Page.Parent) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ template "_internal/pagination.html" $ctx }}
|
||||
</div>
|
||||
|
||||
{{ define "breadcrumbtext" }}
|
||||
{{ if .p1.Parent }}
|
||||
{{ if not .p1.Parent.IsHome }}
|
||||
{{ template "breadcrumbtext" (dict "p1" .p1.Parent) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .p1.Parent }}
|
||||
{{ if .p1.Parent.IsHome }}
|
||||
<span>{{ .p1.Title }}</span>
|
||||
{{ else }}
|
||||
<span>/</span>
|
||||
<span>{{ .p1.Title }}</span>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- $styles := resources.Get "scss/core.scss" -}}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{- $tocss_opts := dict "targetPath" "style.css" "outputStyle" "compressed" "enableSourceMap" true -}}
|
||||
{{- $styles = $styles | resources.ToCSS $tocss_opts | resources.Minify | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{- $tocss_opts := dict "targetPath" "style.css" "enableSourceMap" true -}}
|
||||
{{- $styles = $styles | resources.ToCSS $tocss_opts -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{- $styles.RelPermalink -}}" integrity="{{- $styles.Data.Integrity -}}">
|
||||
|
||||
{{/* Prism.js style */}}
|
||||
{{ if or (and (findRE "<pre" .Content 1) (eq (.Scratch.Get "params").syntax_highlight.lib "prism.js")) (.HasShortcode "emgithub") }}
|
||||
{{ $prism_css := resources.Get "lib/css/prism.css" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $prism_css = $prism_css | resources.Minify | resources.Fingerprint "sha512" -}}
|
||||
{{- end -}}
|
||||
<link rel="stylesheet" href="{{- $prism_css.RelPermalink -}}" integrity="{{- $prism_css.Data.Integrity -}}">
|
||||
{{ end }}
|
||||
@@ -0,0 +1,95 @@
|
||||
{{/* Header */}}
|
||||
{{ $header_js := resources.Get "js/header.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $header_js = $header_js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $header_js = $header_js | js.Build -}}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $header_js.RelPermalink }}" integrity="{{- $header_js.Data.Integrity -}}"></script>
|
||||
|
||||
{{/* Zooming.js */}}
|
||||
{{ if (.Scratch.Get "params").enable_zooming_js }}
|
||||
{{ $zooming_js := resources.Get "js/zooming.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $zooming_js = $zooming_js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $zooming_js = $zooming_js | js.Build -}}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $zooming_js.RelPermalink }}" integrity="{{- $zooming_js.Data.Integrity -}}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* MathJax */}}
|
||||
{{ if (.Scratch.Get "params").math }}
|
||||
{{ $math_js := resources.Get "js/math.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $math_js = $math_js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $math_js = $math_js | js.Build -}}
|
||||
{{- end -}}
|
||||
<script type="text/javascript" id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
<script defer src="{{ $math_js.RelPermalink }}" integrity="{{- $math_js.Data.Integrity -}}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Load script for only page contain codeblock */}}
|
||||
{{ if (findRE "<pre" .Content 1) }}
|
||||
{{ if eq (.Scratch.Get "params").syntax_highlight.lib "builtin" }}
|
||||
{{ $enable_code_copy := (.Scratch.Get "params").syntax_highlight.builtin.enable_code_copy | default true }}
|
||||
{{ if $enable_code_copy }}
|
||||
{{ $code_copy_js := resources.Get "js/builtin-copy.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $code_copy_js = $code_copy_js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $code_copy_js = $code_copy_js | js.Build -}}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $code_copy_js.RelPermalink }}" integrity="{{- $code_copy_js.Data.Integrity -}}"></script>
|
||||
{{ end }}
|
||||
{{ else if eq (.Scratch.Get "params").syntax_highlight.lib "prism.js" }}
|
||||
{{ $prism_js := slice (resources.Get "lib/js/prism-v1.29.0.min.js") }}
|
||||
|
||||
{{ $enable_line_no := (.Scratch.Get "params").syntax_highlight.prism.enable_line_no | default true }}
|
||||
{{ if $enable_line_no }}
|
||||
{{ $prism_js = $prism_js | append (resources.Get "lib/js/prism-line-numbers-v1.29.0.min.js") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $enable_code_copy := (.Scratch.Get "params").syntax_highlight.prism.enable_code_copy | default true }}
|
||||
{{ if $enable_code_copy }}
|
||||
{{ $prism_js = $prism_js | append (resources.Get "lib/js/prism-copy-to-clipboard-v1.29.0.min.js") }}
|
||||
{{ end }}
|
||||
|
||||
{{ $prism_js = $prism_js | append (resources.Get "js/prism-autoloader.js") | append (resources.Get "js/prism.js") | resources.Concat "js/prism.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $prism_js = $prism_js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $prism_js = $prism_js | js.Build -}}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $prism_js.RelPermalink }}" integrity="{{- $prism_js.Data.Integrity -}}" data-manual></script>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if (.Scratch.Get "params").enable_site_search }}
|
||||
{{ $target_path := printf "js/search-%s.js" .Site.LanguageCode }}
|
||||
{{ $index_url := "index.json" | absLangURL }}
|
||||
{{ $build_opts := dict "targetPath" $target_path "params" (dict "index_url" $index_url) }}
|
||||
{{ $search_js := resources.Get "js/search.js" | js.Build $build_opts }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $search_js = $search_js | js.Build (merge $build_opts (dict "minify" true)) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $search_js = $search_js | js.Build $build_opts -}}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $search_js.RelPermalink }}" integrity="{{- $search_js.Data.Integrity -}}"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Load highlighter for emgithub */}}
|
||||
{{ if .HasShortcode "emgithub" }}
|
||||
{{ $js := slice (resources.Get "lib/js/prism-v1.29.0.min.js") }}
|
||||
{{ $js = $js | append (resources.Get "lib/js/prism-line-numbers-v1.29.0.min.js") }}
|
||||
{{ $js = $js | append (resources.Get "lib/js/prism-copy-to-clipboard-v1.29.0.min.js") }}
|
||||
{{ $js = $js | append (resources.Get "js/prism-autoloader.js") }}
|
||||
{{ $js = $js | resources.Concat "js/emgithub-prism.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $js = $js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $js = $js | js.Build }}
|
||||
{{- end -}}
|
||||
<script defer src="{{ $js.RelPermalink }}" integrity="{{- $js.Data.Integrity -}}" data-manual></script>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
<div id="search_menu_wrapper" class="hidden">
|
||||
<div id="search_menu">
|
||||
<div id="search_menu_toolbar">
|
||||
<div id="search_menu_input_wrapper">
|
||||
<input id="search_menu_input" type="text" placeholder='{{ i18n "search" }}'>
|
||||
</div>
|
||||
<div id="search_menu_close_btn">
|
||||
<svg width="18px" height="18px" viewBox="0 0 24 24">
|
||||
{{- partial "svg/feather.html" "x" -}}
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<div id="search_menu_results">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
19
themes/hugo-theme-monochrome/layouts/partials/sidebar.html
Normal file
19
themes/hugo-theme-monochrome/layouts/partials/sidebar.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<div id="sidebar_canvas_overlay" class="hidden"></div>
|
||||
<div id="sidebar" class="close">
|
||||
<ul>
|
||||
{{- range .Site.Menus.navbar -}}
|
||||
{{- if .Children -}}
|
||||
<li>
|
||||
<details>
|
||||
<summary><a href="{{ .URL }}">{{- .Name -}}</a></summary>
|
||||
{{- partial "navbar/nested-mobile.html" . -}}
|
||||
</details>
|
||||
</li>
|
||||
{{- else -}}
|
||||
<li>
|
||||
<a href="{{ .URL }}">{{- .Name -}}</a>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
{{- $icon_name := . -}}
|
||||
{{- $feather_sprite := resources.Get "lib/icns/feather-sprite-v4.29.0.svg" -}}
|
||||
{{- $regex := printf `<symbol id="%s".*?>(.*?)<\/symbol>` $icon_name -}}
|
||||
{{- $path := index (index (findRESubmatch $regex $feather_sprite.Content) 0) 1 | safeHTML }}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="24" height="24" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
{{ $path }}
|
||||
</svg>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
{{ if . }}
|
||||
{{ $fontSmall := 1 }}
|
||||
{{ $fontBig := 1.6 }}
|
||||
{{ $fontSpread := sub $fontBig $fontSmall }}
|
||||
|
||||
{{ $termCount := slice }}
|
||||
{{ range . }}
|
||||
{{ $termCount = append .Count $termCount }}
|
||||
{{ end }}
|
||||
{{ $termCount = sort $termCount }}
|
||||
|
||||
{{ $min := int (index $termCount 0) }}
|
||||
{{ $max := add (int (index $termCount (sub (len $termCount) 1))) 1 }}
|
||||
|
||||
<div>
|
||||
{{ range . }}
|
||||
{{ $weight := div (sub (math.Log .Count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
|
||||
{{ $fontSize := (add $fontSmall (mul $fontSpread $weight)) }}
|
||||
|
||||
<a class="term-item" href="{{ .Page.RelPermalink }}">
|
||||
<span style="font-size:{{ $fontSize }}rem">{{- .Page.Title -}}</span>
|
||||
<span style="font-size:{{ sub $fontSmall 0.2 }}rem"> ({{- .Count -}}) </span>
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
11
themes/hugo-theme-monochrome/layouts/postcard/list.html
Normal file
11
themes/hugo-theme-monochrome/layouts/postcard/list.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ define "content" }}
|
||||
|
||||
{{ if and .Content (eq .Paginator.PageNumber 1) }}
|
||||
<div class="content-margin">
|
||||
{{- partial "content.html" (dict "ctx" . "content" .Content) -}}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ partial "postcard/layout.html" (dict "pages" .RegularPages "ctx" .) }}
|
||||
|
||||
{{ end }}
|
||||
@@ -0,0 +1,25 @@
|
||||
{{ $section_name := .Get "section" }}
|
||||
|
||||
{{ $section := .Site.GetPage $section_name }}
|
||||
{{ if not $section }}
|
||||
{{ errorf "bookcase resource not found" }}
|
||||
{{ end }}
|
||||
|
||||
{{ if ne $section.Kind "section" }}
|
||||
{{ errorf "bookcase resource must be a section" }}
|
||||
{{ end }}
|
||||
|
||||
{{ $list_sections := $section.Params.bookcase_list_sections | default true }}
|
||||
{{ $list_pages := $section.Params.bookcase_list_pages | default true }}
|
||||
|
||||
{{ $pages := default nil }}
|
||||
{{ if and $list_sections $list_pages }}
|
||||
{{ $pages = $section.Pages }}
|
||||
{{ else if $list_sections }}
|
||||
{{ $pages = $section.Sections }}
|
||||
{{ else if $list_pages }}
|
||||
{{ $pages = $section.RegularPages }}
|
||||
{{ end }}
|
||||
|
||||
{{ partial "bookcase/layout.html" (dict "ctx" . "title" $section.Title "content" $section.Content "res" $pages) }}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<div class="content-margin">
|
||||
<ol class="breadcrumbs">
|
||||
{{ template "breadcrumbnav" (dict "p1" .Page) }}
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
{{ define "breadcrumbnav" }}
|
||||
{{ if .p1.Parent }}
|
||||
{{ template "breadcrumbnav" (dict "p1" .p1.Parent) }}
|
||||
{{ else if not .p1.IsHome }}
|
||||
{{ template "breadcrumbnav" (dict "p1" .p1.Site.Home) }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not .p1.IsHome }}
|
||||
<li><span>/</span></li>
|
||||
<li><a href="{{ .p1.Permalink }}">{{ .p1.Title }}</a></li>
|
||||
{{ else }}
|
||||
<li><a href="{{ .p1.Permalink }}">Home</a></li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ $id := .Get "id" }}
|
||||
|
||||
<p class="codepen" data-height="400" data-theme-id="dark" data-default-tab="html,result" data-slug-hash="{{ $id }}" style="height: 400px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;"></p>
|
||||
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>
|
||||
@@ -0,0 +1,22 @@
|
||||
{{ $style := .Get "style" }}
|
||||
|
||||
{{ $bg_color := "#f0f0f0" }}
|
||||
{{ $color := "#494949" }}
|
||||
|
||||
{{ if eq $style "error" }}
|
||||
{{ $bg_color = "#f2dede" }}
|
||||
{{ $color = "#a94442" }}
|
||||
{{ else if eq $style "warning" }}
|
||||
{{ $bg_color = "#fcf8e3" }}
|
||||
{{ $color = "#8a6d3b" }}
|
||||
{{ else if eq $style "info" }}
|
||||
{{ $bg_color = "#d9edf7" }}
|
||||
{{ $color = "#31708f" }}
|
||||
{{ else if eq $style "success" }}
|
||||
{{ $bg_color = "#dff0d8" }}
|
||||
{{ $color = "#3c763d" }}
|
||||
{{ end }}
|
||||
|
||||
<div class="color-block content-margin" style="background-color: {{ $bg_color }}; color: {{ $color }};" >
|
||||
{{ .Inner | safeHTML }}
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
{{ $target := .Get "target" }}
|
||||
{{ $lang := .Get "lang" | default "text" }}
|
||||
{{ $hl := .Get "hl" }}
|
||||
{{ $tab_size := .Get "tab_size" | default "4" }}
|
||||
|
||||
{{ $target_obj := urls.Parse $target }}
|
||||
{{ $target_host := $target_obj.Host }}
|
||||
{{ if not $target }}
|
||||
{{ errorf "emgithub shortcode in %s has no target" .Position }}
|
||||
{{ else if not (eq $target_host "github.com") }}
|
||||
{{ errorf "emgithub shortcode in %s has unsupported target host: %s" .Position $target_host }}
|
||||
{{ end }}
|
||||
|
||||
{{ $target_path := (split $target_obj.Path "/") }}
|
||||
{{ $user := index $target_path 1 }}
|
||||
{{ $repo := index $target_path 2 }}
|
||||
{{ $branch := index $target_path 4 }}
|
||||
{{ $file := delimit (after 5 $target_path) "/" }}
|
||||
{{ $raw_file_url := printf "https://cdn.jsdelivr.net/gh/%s/%s@%s/%s" $user $repo $branch $file }}
|
||||
|
||||
{{ $line_range := split (trim $target_obj.Fragment " ") "-" }}
|
||||
{{ $line_range_begin := (trim (index $line_range 0) " L") }}
|
||||
{{ $line_range_end := (trim (index $line_range 1) " L") }}
|
||||
|
||||
{{ if and (eq $line_range_begin "") (eq $line_range_end "") }}
|
||||
{{ $line_range_begin = 0 }}
|
||||
{{ $line_range_end = 0 }}
|
||||
{{ else if and (ne $line_range_begin "") (eq $line_range_end "") }}
|
||||
{{ $line_range_end = $line_range_begin }}
|
||||
{{ else if or (eq $line_range_begin "") (eq $line_range_end "") }}
|
||||
{{ errorf "emgithub shortcode in %s has wrong line range format: range begin after parsing: %s, range end after parsing %s" .Position $line_range_begin $line_range_end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $line_range_begin = int $line_range_begin }}
|
||||
{{ $line_range_end = int $line_range_end }}
|
||||
|
||||
{{ if gt $line_range_begin $line_range_end }}
|
||||
{{ $tmp := $line_range_begin }}
|
||||
{{ $line_range_begin = $line_range_end }}
|
||||
{{ $line_range_end = $tmp }}
|
||||
{{ end }}
|
||||
|
||||
{{ $line_range_diff := add (sub $line_range_end $line_range_begin) 1 }}
|
||||
|
||||
|
||||
<div id="emgithub_{{ .Ordinal }}" class="emgithub-container">
|
||||
<div class="emgithub-code">
|
||||
<div class="emgithub-loading">
|
||||
<svg role="status" class="mr-2 w-8 h-8 text-gray-200 animate-spin fill-gray-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
|
||||
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
|
||||
</svg>
|
||||
</div>
|
||||
<pre style="tab-size: {{ $tab_size }}" class="emgithub-pre line-numbers loading" data-start="{{ $line_range_begin }}" {{ if $hl }}data-line="{{ $hl }}" data-line-offset="{{ $line_range_begin }}"{{ end }}></pre>
|
||||
</div>
|
||||
<div class="emgithub-toolbar">
|
||||
<a target="_blank" href="{{ $target }}">{{ $file }}</a>
|
||||
<a target="_blank" href="{{ $raw_file_url }}">view raw</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ $js := resources.Get "js/emgithub.js" }}
|
||||
{{- if hugo.IsProduction -}}
|
||||
{{ $js = $js | js.Build (dict "minify" true) | resources.Fingerprint "sha512" -}}
|
||||
{{- else -}}
|
||||
{{ $js = $js | js.Build }}
|
||||
{{- end -}}
|
||||
<script defer src='{{ $js.RelPermalink }}?raw_file_url={{ $raw_file_url }}&lang={{ $lang }}&line_begin={{ $line_range_begin }}&line_end={{ $line_range_end }}&id=emgithub_{{ .Ordinal }}' integrity="{{- $js.Data.Integrity -}}"></script>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div class="icon-group">
|
||||
{{ .Inner | safeHTML }}
|
||||
</div>
|
||||
19
themes/hugo-theme-monochrome/layouts/shortcodes/icon.html
Normal file
19
themes/hugo-theme-monochrome/layouts/shortcodes/icon.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- $icon_vendor := .Get "vendor" -}}
|
||||
{{- $icon_link := .Get "link" -}}
|
||||
{{- $icon_name := .Get "name" -}}
|
||||
|
||||
<div class="icon">
|
||||
{{ if $icon_link }}
|
||||
<a rel="noopener" target="_blank" href="{{ $icon_link }}" aria-label="{{ $icon_name }}">
|
||||
{{ else }}
|
||||
<div>
|
||||
{{ end }}
|
||||
{{ if eq $icon_vendor "feather" }}
|
||||
{{ partial "svg/feather.html" $icon_name }}
|
||||
{{ end }}
|
||||
{{ if $icon_link }}
|
||||
</a>
|
||||
{{ else }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
{{ $id := .Get "id" }}
|
||||
|
||||
<iframe width="100%" height="400" src="//jsfiddle.net/{{ $id }}/embedded/js,html,css,result/dark/" allowfullscreen="allowfullscreen" allowpaymentrequest frameborder="0"></iframe>
|
||||
@@ -0,0 +1,35 @@
|
||||
{{ $sortby := .Get "sortby" }}
|
||||
{{ $limit := int (.Get "limit") }}
|
||||
{{ $pages := .Site.RegularPages }}
|
||||
|
||||
{{- if $pages -}}
|
||||
{{- if eq $sortby "publishDate" -}}
|
||||
{{- $pages = $pages.ByPublishDate.Reverse -}}
|
||||
{{- else if eq $sortby "lastMod" -}}
|
||||
{{- $pages = $pages.ByLastmod.Reverse -}}
|
||||
{{- else -}}
|
||||
{{- errorf "Unsupported recent posts sort option" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if gt $limit 0 -}}
|
||||
{{- $pages = first $limit $pages -}}
|
||||
{{- end -}}
|
||||
|
||||
<ul class="list-layout">
|
||||
{{ range $pages }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{- .Title -}}
|
||||
</a>
|
||||
<span>
|
||||
{{- if eq $sortby "publishDate" -}}
|
||||
{{- .PublishDate.Format "2006/01/02" -}}
|
||||
{{- else if eq $sortby "lastMod" -}}
|
||||
{{- .Lastmod.Format "2006/01/02" -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{{ $terms := .Get "terms" }}
|
||||
<div class="content-margin">
|
||||
{{- partial "terms-cloud.html" (index .Site.Taxonomies $terms) -}}
|
||||
</div>
|
||||
Reference in New Issue
Block a user