chore: refactor code style
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="notfound">
|
||||
<div class="page" id="content-404">
|
||||
<h1 id="error-emoji"></h1>
|
||||
<p class="error-text">
|
||||
{{- T "pageNotFoundText" -}}
|
||||
|
||||
@@ -7,11 +7,17 @@
|
||||
<html lang="{{ .Site.LanguageCode }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noodp" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<title>
|
||||
{{- block "title" . }}{{ .Site.Title }}{{ end -}}
|
||||
</title>
|
||||
{{- partial "head.html" . -}}
|
||||
<meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
|
||||
|
||||
{{- partial "head/meta.html" . -}}
|
||||
{{- partial "head/link.html" . -}}
|
||||
{{- partial "head/seo.html" . -}}
|
||||
</head>
|
||||
<body>
|
||||
{{- /* Check theme isDark before body rendering */ -}}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="post-title animated pulse faster">
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- T "all" | humanize}}{{ T .Section | default .Section | humanize -}}
|
||||
</h2>
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<div class="page single">
|
||||
<div class="page single special">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="post-title animated pulse faster">
|
||||
<h1 class="single-title animated pulse faster">
|
||||
{{- .Title -}}
|
||||
</h1>
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="post-content">
|
||||
<div class="content">
|
||||
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<article class="post summary" itemscope itemtype="http://schema.org/Article">
|
||||
<article class="single summary" itemscope itemtype="http://schema.org/Article">
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with .Params.featured_image -}}
|
||||
<div class="post-featured-image-preview">
|
||||
<div class="featured-image-preview">
|
||||
{{- $image := $.Params.featured_image_preview | default . -}}
|
||||
{{- partial "image" $image -}}
|
||||
{{- partial "hook/image" $image -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="post-title" itemprop="name headline">
|
||||
<h1 class="single-title" itemprop="name headline">
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
</h1>
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
<div class="meta">
|
||||
{{- $author := .Params.author | default .Site.Author.name -}}
|
||||
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
|
||||
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
|
||||
{{- /* Summary content */ -}}
|
||||
<div class="post-content">
|
||||
<div class="content">
|
||||
{{- if .Params.description_as_summary -}}
|
||||
<p>
|
||||
{{- .Params.description -}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{- define "content" -}}
|
||||
{{- /* Home mode [post] */ -}}
|
||||
{{- if eq .Site.Params.home_mode "post" -}}
|
||||
<div class="page home">
|
||||
<div class="page home">
|
||||
{{- /* Home mode [post] */ -}}
|
||||
{{- if eq .Site.Params.home_mode "post" -}}
|
||||
{{- /* Profile */ -}}
|
||||
{{- partial "home/profile.html" . -}}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
{{- .Render "summary" -}}
|
||||
{{- end -}}
|
||||
{{- partial "paginator.html" . -}}
|
||||
</div>
|
||||
|
||||
{{- /* Home mode [other] */ -}}
|
||||
{{- else -}}
|
||||
{{- /* Profile */ -}}
|
||||
{{- partial "home/profile.html" . -}}
|
||||
{{- end -}}
|
||||
{{- /* Home mode [other] */ -}}
|
||||
{{- else -}}
|
||||
{{- /* Profile */ -}}
|
||||
{{- partial "home/profile.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
{{- if .Site.Params.cdn.gitalk_css -}}
|
||||
{{- .Site.Params.cdn.gitalk_css | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- $res := resources.Get "css/lib/gitalk/gitalk.css" | resources.Minify -}}
|
||||
{{- $res := resources.Get "css/lib/gitalk/gitalk.css" | minify -}}
|
||||
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
||||
{{- end -}}
|
||||
{{- if .Site.Params.cdn.gitalk_js -}}
|
||||
{{ .Site.Params.cdn.gitalk_js | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" | resources.Minify -}}
|
||||
{{- $res := resources.Get "js/lib/gitalk/gitalk.min.js" -}}
|
||||
<script src="{{ $res.RelPermalink }}"></script>
|
||||
{{- end -}}
|
||||
<script>
|
||||
@@ -43,7 +43,7 @@
|
||||
{{- if .Site.Params.cdn.valine_js -}}
|
||||
{{- .Site.Params.cdn.valine_js | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- $res := resources.Get "js/lib/valine/Valine.min.js" | resources.Minify -}}
|
||||
{{- $res := resources.Get "js/lib/valine/Valine.min.js" -}}
|
||||
<script src="{{ $res.RelPermalink }}"></script>
|
||||
{{- end -}}
|
||||
<script>
|
||||
@@ -1,27 +1,3 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="robots" content="noodp" />
|
||||
<meta name="Description" content="{{ .Params.description | default .Site.Params.description }}">
|
||||
{{- with .Site.Params.google_verification -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.bing_verification -}}
|
||||
<meta name="msvalidate.01" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.yandex_verification -}}
|
||||
<meta name="yandex-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.pinterest_verification -}}
|
||||
<meta name="p:domain_verify" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.baidu_verification -}}
|
||||
<meta name="baidu-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- if .PrevInSection -}}
|
||||
<link rel="prev" href="{{ .PrevInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
{{- if .NextInSection -}}
|
||||
<link rel="next" href="{{ .NextInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
<link rel="canonical" href="{{ .Permalink }}" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
@@ -29,31 +5,27 @@
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||
<link rel="manifest" href="/site.webmanifest">
|
||||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
|
||||
{{- if .PrevInSection -}}
|
||||
<link rel="prev" href="{{ .PrevInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
{{- if .NextInSection -}}
|
||||
<link rel="next" href="{{ .NextInSection.Permalink }}" />
|
||||
{{- end -}}
|
||||
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
<link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
|
||||
<link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ $.Site.Title }}">
|
||||
{{- end -}}
|
||||
|
||||
{{- template "_internal/opengraph.html" . -}}
|
||||
|
||||
{{- $share := .Params.share.enable | default .Site.Params.share.enable | eq true -}}
|
||||
{{- if $share | and (.Params.Share.Twitter | default .Site.Params.Share.Twitter | eq true) -}}
|
||||
{{- template "_internal/twitter_cards.html" . -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- partial "seo.html" . -}}
|
||||
|
||||
{{- /* style.min.css */ -}}
|
||||
{{- $res := resources.Get "css/style.template.scss" -}}
|
||||
{{- $options := dict "targetPath" "css/style.min.css" "outputStyle" "compressed" "enableSourceMap" true -}}
|
||||
{{- if fileExists "config/css/_custom.scss" -}}
|
||||
{{- $options = dict "includePaths" (slice "config/css") | merge $options -}}
|
||||
{{- $res := resources.Get "css/custom-style.scss" | toCSS $options -}}
|
||||
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
||||
{{- else -}}
|
||||
{{- $res := resources.Get "css/style.scss" | toCSS $options -}}
|
||||
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
||||
{{- end -}}
|
||||
{{- $res = resources.ExecuteAsTemplate "style.scss" . $res | toCSS $options -}}
|
||||
<link rel="stylesheet" href="{{ $res.RelPermalink }}">
|
||||
|
||||
{{- /* Font Awesome https://fontawesome.com/ */ -}}
|
||||
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.cdn.fontawesome_free_css -}}
|
||||
21
layouts/partials/head/meta.html
Normal file
21
layouts/partials/head/meta.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- with .Site.Params.google_verification -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.bing_verification -}}
|
||||
<meta name="msvalidate.01" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.yandex_verification -}}
|
||||
<meta name="yandex-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.pinterest_verification -}}
|
||||
<meta name="p:domain_verify" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.baidu_verification -}}
|
||||
<meta name="baidu-site-verification" content="{{ . }}" />
|
||||
{{- end -}}
|
||||
|
||||
{{- template "_internal/opengraph.html" . -}}
|
||||
{{- template "_internal/twitter_cards.html" . -}}
|
||||
|
||||
<meta name="theme-color" content="#ffffff">
|
||||
<meta name="msapplication-TileColor" content="#da532c">
|
||||
@@ -1,12 +1,12 @@
|
||||
{{- /* Desktop navbar */ -}}
|
||||
<nav class="navbar">
|
||||
<div class="navbar-container">
|
||||
<div class="navbar-header animated bounceIn">
|
||||
{{- /* Desktop header */ -}}
|
||||
<header class="desktop">
|
||||
<div class="header-wrapper">
|
||||
<div class="header-title animated bounceIn">
|
||||
<a href="{{ .Site.BaseURL }}">
|
||||
{{- .Site.Title -}}
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-menu">
|
||||
<div class="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 }}">
|
||||
@@ -16,13 +16,13 @@
|
||||
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title="{{ T "switchTheme" }}"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
{{- /* Mobile navbar */ -}}
|
||||
<nav class="navbar-mobile">
|
||||
<div class="navbar-container">
|
||||
<div class="navbar-header">
|
||||
<div class="navbar-header-title animated bounceIn">
|
||||
{{- /* Mobile header */ -}}
|
||||
<header class="mobile">
|
||||
<div class="header-wrapper">
|
||||
<div class="header-container">
|
||||
<div class="header-title animated bounceIn">
|
||||
<a href="{{ .Site.BaseURL }}">
|
||||
{{- .Site.Title -}}
|
||||
</a>
|
||||
@@ -31,7 +31,7 @@
|
||||
<span></span><span></span><span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-menu" id="mobile-menu">
|
||||
<div class="menu" id="menu-mobile">
|
||||
{{- $currentPage := . -}}
|
||||
{{- range .Site.Menus.main -}}
|
||||
<a class="menu-item" href="{{ .URL | absLangURL }}" title="{{ .Title }}">
|
||||
@@ -41,4 +41,4 @@
|
||||
<a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw" title="{{ T "switchTheme" }}"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div class="home-intro">
|
||||
<div class="home-profile">
|
||||
{{- $avatar := "" -}}
|
||||
{{- if .Site.Params.gravatar.email -}}
|
||||
{{- $avatar = (printf "https://www.gravatar.com/avatar/%s?s=240&d=mp" (md5 .Site.Params.gravatar.email)) -}}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
<article class="page post">
|
||||
<article class="page single">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="post-title animated flipInX">{{ .Title }}</h1>
|
||||
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
<div class="post-meta">
|
||||
<div class="post-meta-main">
|
||||
<div class="meta">
|
||||
<div class="meta-line">
|
||||
{{- $author := .Params.author | default .Site.Author.name -}}
|
||||
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
|
||||
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
|
||||
@@ -25,7 +25,7 @@
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-meta-other">
|
||||
<div class="meta-line">
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
<i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>
|
||||
<i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}
|
||||
@@ -40,8 +40,8 @@
|
||||
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with .Params.featured_image -}}
|
||||
<div class="post-featured-image">
|
||||
{{- partial "image" . -}}
|
||||
<div class="featured-image">
|
||||
{{- partial "hook/image" . -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="post-content">
|
||||
<div class="content">
|
||||
{{- partial "hook/content.html" .Content | safeHTML -}}
|
||||
</div>
|
||||
|
||||
@@ -80,9 +80,9 @@
|
||||
{{- partial "post/footer.html" . -}}
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
<div class="post-comment">
|
||||
<div class="comment">
|
||||
{{- if ( .Params.comment | default true ) -}}
|
||||
{{- partial "comments.html" . -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{{- define "content" -}}
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="post-title animated pulse faster">
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- $taxonomy := .Data.Singular -}}
|
||||
{{- if eq $taxonomy "category" -}}
|
||||
<i class="far fa-folder-open fa-fw"></i> {{ humanize .Title }}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<div class="page archive">
|
||||
{{- /* Title */ -}}
|
||||
<h2 class="post-title animated pulse faster">
|
||||
<h2 class="single-title animated pulse faster">
|
||||
{{- T "all" | humanize}}{{ T $taxonomies | default $taxonomies | humanize -}}
|
||||
</h2>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{{- end -}}
|
||||
{{- if gt (len $pages) 5 -}}
|
||||
<span class="more-post">
|
||||
<a href="{{ .Permalink }}" class="more-post-link">{{ T "more" }} >></a>
|
||||
<a href="{{ .Permalink }}" class="more-single-link">{{ T "more" }} >></a>
|
||||
</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user