Browse Source

Update theme

Track3 6 years ago
parent
commit
706346f82e

+ 20 - 0
.editorconfig

@@ -0,0 +1,20 @@
+# editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.{html,xml}]
+indent_style = tab
+
+[*.md]
+indent_style = unset
+indent_size = unset
+insert_final_newline = unset
+trim_trailing_whitespace = unset

+ 50 - 29
assets/js/main.js

@@ -48,14 +48,22 @@ const throttle = (callback, limit) => {
   };
 };
 
+// addEventListener Helper
+//
+const listen = (ele, e, callback) => {
+  if (document.querySelector(ele) !== null) {
+    document.querySelector(ele).addEventListener(e, callback);
+  }
+}
+
 /**
  * Functions
  */
 
 // Auto Hide Header
 //
-let lastScrollPosition = window.pageYOffset;
 let header = document.getElementById('site-header');
+let lastScrollPosition = window.pageYOffset;
 
 const autoHideHeader = () => {
   let currentScrollPosition = window.pageYOffset;
@@ -71,10 +79,10 @@ const autoHideHeader = () => {
 
 // Mobile Menu Toggle
 //
-let mobileMenu = document.getElementById('mobile-menu');
 let mobileMenuVisible = false;
 
-const mobileMenuToggle = () => {
+const toggleMobileMenu = () => {
+  let mobileMenu = document.getElementById('mobile-menu');
   if (mobileMenuVisible == false) {
     mobileMenu.style.animationName = 'bounceInRight';
     mobileMenu.style.webkitAnimationName = 'bounceInRight';
@@ -87,16 +95,20 @@ const mobileMenuToggle = () => {
   }
 }
 
-document.getElementById('menu-btn').addEventListener('click', mobileMenuToggle);
-
-// Show Featured Image
+// Featured Image Toggle
 //
-const showFeaturedImg = () => {
-  document.getElementById('bg-img').classList.add('show-bg-img');
+const showImg = () => {
+  document.querySelector('.bg-img').classList.add('show-bg-img');
 }
 
-const showContent = () => {
-  document.getElementById('bg-img').classList.remove('show-bg-img');
+const hideImg = () => {
+  document.querySelector('.bg-img').classList.remove('show-bg-img');
+}
+
+// ToC Toggle
+//
+const toggleToc = () => {
+  document.getElementById('toc').classList.toggle('show-toc');
 }
 
 //Load Comments
@@ -115,8 +127,7 @@ const loadComments = () => {
         el: '#comments',
         appId: 'QfBLso0johYg7AXtV9ODU6FC-gzGzoHsz',
         appKey: 'J1tpEEsENa48aLVsPdvwMP14',
-        placeholder: '说点什么吧',
-        verify: true
+        placeholder: '说点什么吧'
       });
       commentsLoader.style.display = 'none';
     }, () => {
@@ -127,24 +138,34 @@ const loadComments = () => {
   });
 }
 
-// Load comments if the window is not scrollable
-if ((haveComments == true) && (comments.offsetTop < window.innerHeight)) {
-  commentsLoader.style.display = 'block';
-  loadComments();
-  commentsLoaded = true;
-}
 
-window.addEventListener('scroll', throttle(() => {
-  autoHideHeader();
-  if (mobileMenuVisible == true) {
-    mobileMenuToggle();
+if (header !== null) {
+  listen('#menu-btn', "click", toggleMobileMenu);
+  listen('#toc-btn', "click", toggleToc);
+  listen('#img-btn', "click", showImg);
+  listen('.bg-img', "click", hideImg);
+
+  // Load comments if the window is not scrollable
+  if ((comments !== null) && (comments.offsetTop < window.innerHeight)) {
+    commentsLoader.style.display = 'block';
+    loadComments();
+    commentsLoaded = true;
   }
 
-  if ((haveComments == true) && (commentsLoaded == false)) {
-    if (window.pageYOffset + window.innerHeight > comments.offsetTop) {
-      commentsLoader.style.display = 'block';
-      loadComments();
-      commentsLoaded = true;
+  window.addEventListener('scroll', throttle(() => {
+    autoHideHeader();
+    if (mobileMenuVisible == true) {
+      mobileMenuToggle();
     }
-  }
-}, 250));
+
+    if ((comments !== null) && (commentsLoaded == false)) {
+      if (window.pageYOffset + window.innerHeight > comments.offsetTop) {
+        commentsLoader.style.display = 'block';
+        loadComments();
+        commentsLoaded = true;
+      }
+    }
+  }, 250));
+}
+
+

+ 73 - 45
assets/scss/style.scss

@@ -145,40 +145,8 @@ table {
   height: 1em;
 }
 
-// Accessibility
-//
-.screen-reader-text {
-	border: 0;
-	clip: rect(1px, 1px, 1px, 1px);
-	clip-path: inset(50%);
-	height: 1px;
-	margin: -1px;
-	overflow: hidden;
-	padding: 0;
-	position: absolute !important;
-	width: 1px;
-	word-wrap: normal !important;
-}
-
-.screen-reader-text:focus {
-	background-color: #f1f1f1;
-	border-radius: 3px;
-	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
-	clip: auto !important;
-	clip-path: none;
-	color: #21759b;
-	display: block;
-	font-size: 14px;
-	font-size: 0.875rem;
-	font-weight: bold;
-	height: auto;
-	left: 5px;
-	line-height: normal;
-	padding: 15px 23px 14px;
-	text-decoration: none;
-	top: 5px;
-	width: auto;
-	z-index: 100000;
+.desktop-only, .desktop-only-ib {
+  display: none;
 }
 
 // Header & Footer
@@ -234,12 +202,13 @@ table {
   border: none;
   background: none;
   padding: 0;
+  margin-left: .4em;
   cursor: pointer;
 }
 
 #menu-btn {
   display: none;
-  margin-left: .4em;
+  margin-left: .6em;
   cursor: pointer;
 }
 
@@ -247,6 +216,7 @@ table {
   position: fixed;
   bottom: 4.8em;
   right: 1.5em;
+  display: none;
   padding: .6em 1.8em;
   z-index: 1;
   box-sizing: border-box;
@@ -425,8 +395,8 @@ p.img-404 {
 // single.html
 //
 .bg-img {
-  width: 100%;
-  height: 100%;
+  width: 100vw;
+  height: 100vh;
   opacity: .03;
   z-index: -1;
   position: fixed;
@@ -441,6 +411,7 @@ p.img-404 {
 .show-bg-img {
   z-index: 100;
   opacity: 1;
+  cursor: pointer;
 }
 
 .post-header {
@@ -491,13 +462,13 @@ hr.post-end {
     margin-right: 1.5em;
     max-width: 50%;
   }
-  
+
   figure.right {
     float: right;
     margin-left: 1.5em;
     max-width: 50%;
   }
-  
+
   figure.big {
     max-width: 100vw;
   }
@@ -524,7 +495,7 @@ hr.post-end {
     box-shadow: none;
     text-decoration: underline;
     transition-property: color;
-  
+
     &:hover {
       background: transparent;
     }
@@ -573,6 +544,42 @@ hr.post-end {
   }
 }
 
+#toc {
+  position: fixed;
+  left: 50%;
+  top: 0;
+  display: none;
+}
+
+.toc-title {
+  margin-left: 1em;
+  margin-bottom: .5em;
+  font-size: .8em;
+  font-weight: bold;
+}
+
+#TableOfContents {
+  font-size: .8em;
+  @include dimmed;
+
+  ul {
+    padding-left: 1em;
+    margin: 0;
+  }
+
+  &>ul {
+    list-style-type: none;
+
+    ul ul {
+      font-size: .9em;
+    }
+  }
+
+  a:hover {
+    border-bottom: $theme 1px solid;
+  }
+}
+
 .post-nav {
   display: flex;
   justify-content: space-between;
@@ -670,7 +677,8 @@ hr.post-end {
   }
 }
 
-
+// Media Queries
+//
 @media (min-width: 800px) {
   .site-main {
     margin-top: 3em;
@@ -692,13 +700,22 @@ hr.post-end {
     margin-top: 8em;
   }
 
+  .desktop-only,
+  #toc.show-toc {
+    display: block;
+  }
+
+  .desktop-only-ib {
+    display: inline-block;
+  }
+
   figure.left {
     margin-left: -240px;
     p {
       text-align: left;
     }
   }
-  
+
   figure.right {
     margin-right: -240px;
     p {
@@ -714,6 +731,12 @@ hr.post-end {
   hr.post-end {
     width: 30%;
   }
+
+  #toc {
+    top: 13em;
+    margin-left: 370px;
+    max-width: 220px;
+  }
 }
 
 @media (min-width: 1800px) {
@@ -733,7 +756,7 @@ hr.post-end {
     max-width: 75%;
     margin-left: -320px;
   }
-  
+
   figure.right {
     max-width: 75%;
     margin-right: -320px;
@@ -747,6 +770,12 @@ hr.post-end {
   hr.post-end {
     width: 30%;
   }
+
+  #toc {
+    top: 15em;
+    margin-left: 490px;
+    max-width: 300px;
+  }
 }
 
 @media (max-width: 760px) {
@@ -756,8 +785,7 @@ hr.post-end {
     display: none;
   }
 
-  #menu-btn,
-  #search-btn {
+  #menu-btn {
     display: inline-block;
   }
 

+ 2 - 2
layouts/404.html

@@ -8,8 +8,8 @@
 			<p>Oops, page not found…</p>
 			<p class="btn-404">
 				<a href="{{.Site.BaseURL}}"><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" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>Home</a>
-				<a href="/posts"><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" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>Archives</a>
+				<a href="{{ "posts" | absURL }}"><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" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>Archives</a>
 			</p>
 		</div>
 	</div>
-{{ end }}
+{{ end }}

+ 8 - 4
layouts/_default/baseof.html

@@ -7,6 +7,9 @@
 	<meta http-equiv="X-UA-Compatible" content="ie=edge">
 	<meta name="theme-color" content="#494f5c">
 	<meta name="msapplication-TileColor" content="#494f5c">
+	{{- template "_internal/schema.html" . }}
+	{{- template "_internal/opengraph.html" . }}
+	{{- template "_internal/twitter_cards.html" . }}
 	<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
 	<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
 	<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
@@ -18,11 +21,10 @@
 	<link rel="dns-prefetch" href="//cdn1.lncld.net">
 	<link rel="dns-prefetch" href="//unpkg.com">
 	{{ range .AlternativeOutputFormats -}}
-		{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
+	{{ printf `<link rel="%s" type="%s+%s" href="%s" title="%s" />` .Rel .MediaType.Type .MediaType.Suffix .Permalink $.Site.Title | safeHTML }}
 	{{ end -}}
-	{{ with resources.Get "scss/style.scss" | toCSS | minify -}}
-	<style>{{ .Content | safeCSS }}</style>
-	{{- end }}
+	{{ $style := resources.Get "scss/style.scss" | resources.ToCSS "css/style.css" | minify | fingerprint -}}
+	<link rel="stylesheet" href="{{ $style.Permalink }}" {{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }}>
 	{{ block "head" . -}}{{- end }}
 </head>
 
@@ -30,6 +32,8 @@
 	{{ block "header" . -}}{{ end -}}
 	{{ block "main" . -}}{{ end -}}
 	{{ block "footer" . -}}{{ end }}
+	{{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
+	<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
 </body>
 
 </html>

+ 1 - 5
layouts/_default/list.html

@@ -30,8 +30,4 @@
 
 {{ define "footer" }}
 {{ partialCached "footer.html" . }}
-	<script>
-		let haveComments=false;
-		{{- with resources.Get "js/main.js" | minify }}{{ .Content | safeJS }}{{ end }}
-	</script>
-{{ end }}
+{{ end }}

+ 16 - 7
layouts/_default/single.html

@@ -1,14 +1,27 @@
+{{ define "head" }}
+	{{ if .Params.featuredImg -}}
+	<style>.bg-img {background-image: url('{{.Params.featuredImg | absURL}}');}</style>
+	{{- else if .Params.images -}}
+		{{- range first 1 .Params.images -}}
+		<style>.bg-img {background-image: url('{{. | absURL}}');}</style>
+		{{- end -}}
+	{{- end -}}
+{{ end }}
+
 {{ define "header" }}
-{{ partialCached "header.html" . }}
+{{ partial "header.html" . }}
 {{ end }}
 
 {{ define "main" }}
+	{{- if (or .Params.images .Params.featuredImg) }}
+	<div class="bg-img"></div>
+	{{- end }}
 	<main class="site-main section-inner thin animated fadeIn faster">
 		<h1>{{ .Title }}</h1>
 		<div class="content">
 			{{ .Content }}
 		</div>
-		{{- with .Params.comments }}
+		{{ with .Params.comments -}}
 		{{ partialCached "comments.html" . }}
 		{{- end }}
 	</main>
@@ -16,8 +29,4 @@
 
 {{ define "footer" }}
 {{ partialCached "footer.html" . }}
-	<script>
-		let haveComments={{.Params.comments}};
-		{{- with resources.Get "js/main.js" | minify }}{{ .Content | safeJS }}{{ end }}
-	</script>
-{{ end }}
+{{ end }}

+ 18 - 2
layouts/index.html

@@ -1,4 +1,17 @@
+{{ define "head" }}
+	{{ if .Site.Params.bgImg -}}
+	<style>.bg-img {background-image: url('{{.Site.Params.bgImg | absURL}}');}</style>
+	{{- else if .Site.Params.images -}}
+		{{- range first 1 .Site.Params.images -}}
+		<style>.bg-img {background-image: url('{{. | absURL}}');}</style>
+		{{- end -}}
+	{{- end -}}
+{{ end }}
+
 {{ define "main" }}
+	{{- if (or .Site.Params.images .Site.Params.bgImg) }}
+	<div class="bg-img"></div>
+	{{- end }}
 	<div id="spotlight" class="animated fadeIn">
 		<div id="home-center">
 			<h1 id="home-title">Track3's Blog</h1>
@@ -14,7 +27,10 @@
 			</nav>
 		</div>
 		<div id="home-footer">
-			<p>&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>. Some Rights Reserved.</p>
+			<p>
+				&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>{{ .Site.Params.footerCopyright | safeHTML }}
+				{{- with (not (in (.Site.Language.Get "disableKinds") "RSS")) }} &#183; <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><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" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a>{{ end }}
+			</p>
 		</div>
 	</div>
-{{ end }}
+{{ end }}

+ 2 - 2
layouts/partials/comments.html

@@ -1,4 +1,4 @@
-<div id="comments-loader" class="thin" style="display: none;">
+		<div id="comments-loader" class="thin" style="display: none;">
 			<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" class="feather feather-message-circle animated infinite bounce"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>
 		</div>
-		<div id="comments" class="thin"></div>
+		<div id="comments" class="thin"></div>

+ 1 - 1
layouts/partials/footer.html

@@ -1,4 +1,4 @@
 	<footer id="site-footer" class="section-inner thin animated fadeIn faster">
 		<p>&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a> &#183; <a href="https://creativecommons.org/licenses/by-nc/4.0/deed.zh" target="_blank" rel="noopener">CC BY-NC 4.0</a></p>
 		<p>Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> &#183; <a href="http://www.miitbeian.gov.cn" target="_blank" rel="noopener">鄂ICP备16022650号-1</a> &#183; <a href="{{ "posts/index.xml" | absURL }}" target="_blank" title="rss"><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" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a></p>
-	</footer>
+	</footer>

+ 9 - 7
layouts/partials/header.html

@@ -11,22 +11,24 @@
 				</nav>
 			</div>
 			<div class="hdr-right hdr-icons">
-				{{ with .Params.featuredImg -}}
-				<button class="hdr-btn" onclick="showFeaturedImg()"><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" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
+				{{ if (or .Params.images .Params.featuredImg) -}}
+				<button id="img-btn" class="hdr-btn" title="Featured Image"><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" class="feather feather-image"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg></button>
+				{{- end }}
+				{{- with .Params.toc -}}
+				<button id="toc-btn" class="hdr-btn desktop-only-ib" title="Table Of Contents"><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" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg></button>
 				{{- end }}
 				{{- with .Site.Params.social -}}
 				<span class="hdr-social hide-in-mobile">{{ partialCached "social-icons.html" . }}</span>
 				{{- end -}}
-				<!-- <button id="search-btn" class="hdr-btn"><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" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg></button> -->
-				<!-- <button id="toc-btn" class="hdr-btn"><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" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3" y2="6"></line><line x1="3" y1="12" x2="3" y2="12"></line><line x1="3" y1="18" x2="3" y2="18"></line></svg></button> -->
-				<button id="menu-btn" class="hdr-btn"><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" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
+				<button id="menu-btn" class="hdr-btn" title="Menu"><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" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></button>
+			</div>
 			</div>
 		</div>
 	</header>
-	<div id="mobile-menu" class="animated fast" style="display: none;">
+	<div id="mobile-menu" class="animated fast">
 		<ul>
 			{{- range .Site.Menus.main }}
 			<li><a href="{{ .URL }}">{{ .Name }}</a></li>
 			{{- end }}
 		</ul>
-	</div>
+	</div>

+ 2 - 2
layouts/partials/social-icons.html

@@ -1,3 +1,3 @@
 {{ range . -}}
-<a href="{{ .url }}" target="_blank" rel="noopener">{{ partial "social-svg.html" . }}</a>
-{{- end }}
+<a href="{{ .url }}" target="_blank" rel="noopener" title="{{ .name | humanize }}">{{ partial "svg.html" . }}</a>
+{{- end }}

+ 1 - 1
layouts/partials/social-svg.html → layouts/partials/svg.html

@@ -6,4 +6,4 @@
 <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" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>
 {{- else -}}
 <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" class="feather feather-link"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
-{{- end -}}
+{{- end -}}

+ 25 - 25
layouts/posts/rss.xml

@@ -1,27 +1,27 @@
 <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>
-      <content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content>
-    </item>
-    {{ end }}
-  </channel>
+	<channel>
+		<title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
+		<link>{{ .Permalink }}</link>
+		<description>Recent {{ with .Title }}{{. | humanize}}{{ 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>
+			<content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content>
+		</item>
+		{{ end }}
+	</channel>
 </rss>

+ 19 - 7
layouts/posts/single.html

@@ -1,10 +1,20 @@
+{{ define "head" }}
+	{{ if .Params.featuredImg -}}
+	<style>.bg-img {background-image: url('{{.Params.featuredImg | absURL}}');}</style>
+	{{- else if .Params.images -}}
+		{{- range first 1 .Params.images -}}
+		<style>.bg-img {background-image: url('{{. | absURL}}');}</style>
+		{{- end -}}
+	{{- end -}}
+{{ end }}
+
 {{ define "header" }}
 {{ partial "header.html" . }}
 {{ end }}
 
 {{ define "main" }}
-	{{- with .Params.featuredImg }}
-		<div id="bg-img" class="bg-img" style="background-image: url({{.}});" onclick="showContent()"></div>
+	{{- if (or .Params.images .Params.featuredImg) }}
+	<div class="bg-img"></div>
 	{{- end }}
 	<main class="site-main section-inner animated fadeIn faster">
 		<article class="thin">
@@ -32,6 +42,12 @@
 				{{- end }}
 			</footer>
 		</article>
+		{{- if .Params.toc }}
+		<aside id="toc">
+			<div class="toc-title">Table of Contents</div>
+			{{ .TableOfContents }}
+		</aside>
+		{{- end }}
 		<div class="post-nav thin">
 			{{- with .NextInSection }}
 			<a class="next-post" href="{{ .Permalink }}">
@@ -50,8 +66,4 @@
 
 {{ define "footer" }}
 {{ partialCached "footer.html" . }}
-	<script>
-		let haveComments=true;
-		{{- with resources.Get "js/main.js" | minify }}{{ .Content | safeJS }}{{ end }}
-	</script>
-{{ end }}
+{{ end }}