v1
This commit is contained in:
parent
04ce6eb512
commit
854ce8b0cf
@ -3,8 +3,11 @@ languageCode = "en-us"
|
||||
title = "My New Hugo Site"
|
||||
theme = "hugo-w2ng"
|
||||
pygmentsStyle="github"
|
||||
hasCJKLanguage = true
|
||||
enableEmoji = true
|
||||
[params]
|
||||
Footer = "© 2019 王不对 - **[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/)** - **[RSS](/index.xml)**"
|
||||
HomeDesc = "**[博客](/blog/)和[飞行手册](/flight-rules/)中还有很多文章✨**"
|
||||
AuthorName = "王不对"
|
||||
|
||||
[[menu.main]]
|
||||
@ -26,7 +29,7 @@ pygmentsStyle="github"
|
||||
[[menu.main]]
|
||||
name = "关于"
|
||||
url = "/about/"
|
||||
weight = 3
|
||||
weight = 1
|
||||
|
||||
[markup]
|
||||
[markup.goldmark]
|
||||
|
||||
@ -25,6 +25,9 @@
|
||||
.markdown h4 {
|
||||
@apply leading-loose;
|
||||
}
|
||||
.markdown p {
|
||||
@apply my-4;
|
||||
}
|
||||
.markdown blockquote {
|
||||
@apply bg-gray-100 p-3 mx-3 my-2 border-l-4 border-gray-400;
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
{{- block "main" . }}{{- end }}
|
||||
</main>
|
||||
</div>
|
||||
{{- partial "footer.html" . -}}
|
||||
{{- partialCached "footer.html" . -}}
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -1,12 +1,24 @@
|
||||
{{ define "main" }}
|
||||
<section itemscope itemtype="http://schema.org/Collection" class="max-w-3xl mx-auto leading-relaxed my-6">
|
||||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := $pctx.RegularPages -}}
|
||||
<div class="max-w-3xl mx-auto leading-relaxed my-6">
|
||||
{{- partial "meta.html" . -}}
|
||||
|
||||
{{ range (where $pages "Section" "!=" "") }}
|
||||
<div class="markdown">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
{{- $pctx := . -}}
|
||||
|
||||
{{- $pages := $pctx.RegularPages -}}
|
||||
{{- if .IsHome -}}
|
||||
{{ $pages = .Site.RegularPages }}
|
||||
{{ "**精选:**" | markdownify }}
|
||||
{{- end -}}
|
||||
{{ range $pages }}
|
||||
<article itemscope itemtype="http://schema.org/Article" class="flex flex-col mt-6 mb-12">
|
||||
{{- partial "meta.html" . -}}
|
||||
{{ if (eq $pctx.Kind "taxonomy") }}
|
||||
{{ .Scratch.Set "taxonomy" (add $pctx.Type $pctx.Title) }}
|
||||
{{ end }}
|
||||
{{- partial "taxonomy.html" . -}}
|
||||
<h2 itemprop="name" class="text-2xl"><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
|
||||
<p itemprop="datePublished" content="{{ .Date.Format "2006-01-02" }}" class="">{{ .Date.Format "2006/01/02" }}
|
||||
</p>
|
||||
@ -21,5 +33,14 @@
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
{{- if .IsHome -}}
|
||||
{{ range $tagName, $taxonomy := .Site.Taxonomies.categories }}
|
||||
{{ with $.Site.GetPage (printf "%s/%s" "categories" $tagName) }}
|
||||
<a href="{{ .Permalink }}">{{ $tagName }}</a>({{ len $taxonomy }})
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ .Page.Site.Params.HomeDesc | markdownify }}
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
@ -1,27 +1,6 @@
|
||||
{{ define "main" }}
|
||||
<article itemscope itemtype="http://schema.org/Article" class="max-w-3xl mx-auto leading-relaxed">
|
||||
{{ if .IsPage }}
|
||||
<header class="flex flex-col meta">
|
||||
{{- partial "meta.html" . -}}
|
||||
<h1 itemprop="name" class="text-center text-3xl my-4 md:my-6">{{ .Title }}</h1>
|
||||
{{ if not .Params.disableMeta }}
|
||||
<h3 class="text-center text-xl">
|
||||
{{ with $.Site.Params.AuthorName }}
|
||||
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<span itemprop="name">{{ . }}</span>
|
||||
{{ end }}
|
||||
{{ if .Params.date }}
|
||||
{{ if $.Site.Params.AuthorName }} / {{ end }}
|
||||
<span itemprop="datePublished"
|
||||
content="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</span>
|
||||
{{ end }}
|
||||
</h3>
|
||||
{{ end }}
|
||||
</header>
|
||||
{{ end }}
|
||||
{{ if not .IsHome }}
|
||||
<hr class="block my-10 mx-auto max-w-xs h-px border-t border-black">
|
||||
{{ end }}
|
||||
{{- partial "meta.html" . -}}
|
||||
<div itemprop="articleBody" class="content markdown">
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
0
themes/hugo-w2ng/layouts/_default/summary.html
Normal file
0
themes/hugo-w2ng/layouts/_default/summary.html
Normal file
@ -1,6 +0,0 @@
|
||||
{{ define "main" }}
|
||||
<article class="">
|
||||
<h1 class="">{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
</article>
|
||||
{{ end }}
|
||||
@ -1,6 +1,7 @@
|
||||
<header class="flex flex-col relative border-black border-b-4 md:border-none pb-6 mx-4 md:mx-0 md:w-1/5 md:text-right md:pr-8 bg-white md:text-center">
|
||||
<header
|
||||
class="flex flex-col relative border-black border-b-4 md:border-none pb-6 mx-4 md:mx-0 md:w-1/5 md:text-right md:pr-8 bg-white md:text-center">
|
||||
<div class="">
|
||||
<h1 class="text-4xl md:my-12 mt-4 md:mb-12"><a href="#">Wrong.Wang</a></h1>
|
||||
<h1 class="text-4xl md:my-12 mt-4 md:mb-12"><a href="{{ .Site.BaseURL }}">Wrong.Wang</a></h1>
|
||||
<p class="font-thin italic">前进</p>
|
||||
</div>
|
||||
<input id="menu-check" type="checkbox" class="hidden" />
|
||||
@ -12,9 +13,10 @@
|
||||
</label>
|
||||
<nav id="menu" class="my-2 w-full md:flex-row-reverse hidden md:block">
|
||||
<ul class="list-none pl-0 mx-auto justify-center max-w-xs">
|
||||
{{ $currentPage := . }}
|
||||
{{ range .Site.Menus.main }}
|
||||
<li class="my-4 border-black text-center md:text-right border-b-2 md:border-none pb-1">
|
||||
<a class="py-4 md:border-black md:border-b-2 md:pb-1" href="{{ .URL }}">{{ .Name }}</a>
|
||||
<a class="py-4 md:border-black md:border-b-2 {{ if eq $currentPage.RelPermalink .URL }} font-bold {{ end }} md:pb-1" href="{{ .URL }}">{{ .Name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
||||
@ -1,24 +1,22 @@
|
||||
<div class="flex flex-col md:flex-row justify-between">
|
||||
{{ with .Params.categories }}
|
||||
<ul class="flex justify-end" itemprop="articleSection">
|
||||
{{ range . }}
|
||||
<li class="pr-2"><a href="{{ . | printf "categories/%s" | relURL }}" rel="category">{{ . }}</a></li>
|
||||
{{ if in (add "page" "section") .Kind }}
|
||||
<header class="flex flex-col meta">
|
||||
{{- partial "taxonomy.html" . -}}
|
||||
<h1 itemprop="name" class="text-center text-3xl my-4 md:my-6">{{ .Title }}</h1>
|
||||
{{ if and (not .Params.disableMeta) .IsPage }}
|
||||
<h3 class="text-center text-xl">
|
||||
{{ with $.Site.Params.AuthorName }}
|
||||
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
|
||||
<span itemprop="name">{{ . }}</span>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ with .Params.tags }}
|
||||
<ul class="flex justify-end">
|
||||
{{ range . }}
|
||||
<li itemprop="keywords" class="pl-2 md:pl-4">
|
||||
<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
||||
{{ if and (eq . "markdown") (eq . "markdown") }}
|
||||
<mark>#{{ . }}</mark>
|
||||
{{ else }}
|
||||
#{{ . }}
|
||||
{{ end }}
|
||||
</a>
|
||||
</li>
|
||||
{{ if .Params.date }}
|
||||
{{ if $.Site.Params.AuthorName }} / {{ end }}
|
||||
<span itemprop="datePublished"
|
||||
content="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</span>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</h3>
|
||||
{{ end }}
|
||||
</div>
|
||||
</header>
|
||||
{{ end }}
|
||||
{{ if in (add "page" "section") .Kind }}
|
||||
<hr class="block my-10 mx-auto max-w-xs h-px border-t border-black">
|
||||
{{ end }}
|
||||
34
themes/hugo-w2ng/layouts/partials/taxonomy.html
Normal file
34
themes/hugo-w2ng/layouts/partials/taxonomy.html
Normal file
@ -0,0 +1,34 @@
|
||||
{{ $currentPage := . }}
|
||||
<div class="flex flex-col md:flex-row justify-between ">
|
||||
{{ with .Params.categories }}
|
||||
<ul class="flex justify-end text-gray-800" itemprop="articleSection">
|
||||
{{ range . }}
|
||||
<li class="pl-2 pr-0 md:pl-0 md:pr-2">
|
||||
<a href="{{ . | printf "categories/%s" | relURL }}" rel="category">
|
||||
{{- if eq ($currentPage.Scratch.Get "taxonomy") (add "categories" .) -}}
|
||||
<mark>{{- . -}}</mark>
|
||||
{{- else -}}
|
||||
{{- . -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ with .Params.tags }}
|
||||
<ul class="flex justify-end text-gray-700">
|
||||
{{ range . }}
|
||||
<li itemprop="keywords" class="pl-2 md:pl-4">
|
||||
<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
|
||||
{{- if eq ($currentPage.Scratch.Get "taxonomy") (add "tags" .) -}}
|
||||
<mark>#{{- . -}}</mark>
|
||||
{{- else -}}
|
||||
#{{- . -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ $currentPage.Scratch.Delete "taxonomy" }}
|
||||
Loading…
Reference in New Issue
Block a user