feat: add en/zh README and exampleSite files

This commit is contained in:
Dillon
2019-08-26 02:25:56 +08:00
parent ca6d543878
commit af3161fff6
48 changed files with 912 additions and 2518 deletions

View File

@@ -1,10 +1,10 @@
{{ define "title" }}{{ T "all" }}{{ T .Section | default (humanize .Section) }} | {{ .Site.Title }}{{ end -}}
{{ define "title" }}{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }} | {{ .Site.Title }}{{ end -}}
{{ define "content" -}}
{{ $data := .Data -}}
<div class="post-warp archive">
<h2 class="post-title animated pulse faster">
{{ printf "%s%s" (T "all") (T .Section | default (humanize .Section)) }}
{{ T "all" | humanize}}{{ T .Section | default .Section | humanize }}
</h2>
{{- range (.Paginate (.Pages.GroupByDate "2006")).PageGroups -}}

View File

@@ -4,7 +4,32 @@
<div class="post-warp single">
<h1 class="post-title animated pulse faster">{{ .Title }}</h1>
<div class="post-content">
{{ .Content }}
{{ $content := .Content }}
{{ $REin := `<img src="([^"]+)" alt="([^"]+)?" />` }}
{{ $REout := "<figure><img src=/images/loading.svg data-sizes=auto data-src=$1 alt=$2 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<img src="([^"]+)" alt="([^"]+)?" title="([^"]+)?" />` }}
{{ $REout = "<figure><img src=/images/loading.svg data-src=$1 data-sizes=auto alt=$2 title=$3 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `:\(([\w- ]+?)\):` }}
{{ $REout = `<i class="inline-icon $1"></i>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `\[(.+?)\]\^\((.+?)\)` }}
{{ $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<sup>\[return\]</sup>` }}
{{ $REout = printf "<sup>[%s]</sup>" (T "return") }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(h[23456]) (id=".+?")>` }}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(sup class="footnote-ref") (id="fnref:.+?")>` }}
{{ $REout = `<a class="post-dummy-target" $2></a><$1>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $REin = `<(li) (id="fn:.+?")>` }}
{{ $REout = `<$1><a class="post-dummy-target" $2></a>` }}
{{ $content = replaceRE $REin $REout $content }}
{{ $content | safeHTML }}
</div>
</div>
{{end }}

View File

@@ -34,7 +34,7 @@
</div>
<div class="post-content">
{{ if .Params.show_description }}
<p>{{ . }}</p>
<p>{{ .Params.description }}</p>
{{ else }}
{{ $summary := .Summary }}
{{ $REin := `:\(([\w- ]+?)\):` }}

View File

@@ -6,7 +6,7 @@
<div class="navbar-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
<a class="menu-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) | or (eq $currentPage.RelPermalink .URL) }} active{{ end }}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a>
{{ end }}
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180"></i></a>&nbsp;
</div>
@@ -23,7 +23,7 @@
<div class="navbar-menu" id="mobile-menu">
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name | safeHTML }}</a>
{{ end }}
</div>
</div>

View File

@@ -13,7 +13,7 @@
</div>
<div class="post-info-line">
<div class="post-info-md">
{{ if .Site.Params.linkToMarkDown }}
{{ if .Site.Params.linkToMarkdown }}
{{ with .OutputFormats.Get "markdown" }}
<span><a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">{{ T "seeMarkDown" }}</a></span>
{{ end }}

View File

@@ -14,6 +14,15 @@
{{ $res := resources.Get "js/lib/lazysizes/lazysizes.min.js" | resources.Minify }}
{{ $lazysizes = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
{{ end }}
<!-- Smooth Scroll https://github.com/cferdinandi/smooth-scroll -->
{{ $smooth_scroll := "" }}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js }}
{{ $smooth_scroll = .Site.Params.cdn.smooth_scroll_js }}
{{ else }}
{{ $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify }}
{{ $smooth_scroll = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
{{ end }}
{{ $smooth_scroll = delimit (slice $smooth_scroll "<script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>") "" }}
<!-- KaTeX https://github.com/KaTeX/KaTeX -->
{{ $katex_css := "" }}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.katex_css }}
@@ -102,15 +111,6 @@
{{ $res := resources.Get "js/lib/meting/Meting.min.js" | resources.Minify }}
{{ $meting = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
{{ end }}
<!-- Smooth Scroll https://github.com/cferdinandi/smooth-scroll -->
{{ $smooth_scroll := "" }}
{{ if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.smooth_scroll_js }}
{{ $smooth_scroll = .Site.Params.cdn.smooth_scroll_js }}
{{ else }}
{{ $res := resources.Get "js/lib/smooth-scroll/smooth-scroll.polyfills.min.js" | resources.Minify }}
{{ $smooth_scroll = printf "<script src=\"%s\"></script>" $res.RelPermalink }}
{{ end }}
{{ $smooth_scroll = delimit (slice $smooth_scroll "<script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>") "" }}
{{ $jquery | safeHTML }}
{{ $lazysizes | safeHTML }}

View File

@@ -54,8 +54,6 @@ Disallow: /
# Block pricepi
User-agent: pimonster
Disallow: /
User-agent: Pimonster
Disallow: /
User-agent: SurdotlyBot
Disallow: /

View File

@@ -1,4 +1,4 @@
{{ define "title" }}{{ T "all" }}{{ T .Data.Plural | default (humanize .Data.Plural) }} | {{ .Site.Title }}{{ end }}
{{ define "title" }}{{ T "all" | humanize}}{{ T .Data.Plural | default .Data.Plural | humanize }} | {{ .Site.Title }}{{ end }}
{{ define "content" }}
{{ $taxonomies := .Data.Plural }}
@@ -7,7 +7,7 @@
<div class="post-warp archive">
<h2 class="post-title animated pulse faster">
{{- printf "%s%s" (T "all") (T $taxonomies | default (humanize $taxonomies)) -}}
{{ T "all" | humanize}}{{ T $taxonomies | default $taxonomies | humanize }}
</h2>
<!-- Categories Page -->