Ver Fonte

Add `.GitInfo` for blog posts

Track3 há 6 anos atrás
pai
commit
d0f0725f4c
3 ficheiros alterados com 13 adições e 9 exclusões
  1. 4 4
      assets/scss/style.scss
  2. 5 4
      config.toml
  3. 4 1
      layouts/posts/single.html

+ 4 - 4
assets/scss/style.scss

@@ -466,16 +466,16 @@ figure.right {
     margin-right: .8em;
   }
 
+  a {
+    border: transparent;
+  }
+
   .tag {
     margin-right: .5em;
 
     &::before {
       content: "#"
     }
-
-    a {
-      border: none;
-    }
   }
 }
 

+ 5 - 4
config.toml

@@ -21,10 +21,11 @@ rssLimit = 10
   category = ""
 
 [params]
-  author         = "Track3"
-  dateform       = "Jan 2, 2006"
-  dateformFull   = "2006-01-02 15:04"
-  dateformShort  = "Jan 2"
+  author          = "Track3"
+  dateform        = "Jan 2, 2006"
+  dateformShort   = "Jan 2"
+  dateformNum     = "2006-01-02"
+  dateformNumTime = "2006-01-02 15:04"
 
 [menu]
 

+ 4 - 1
layouts/posts/single.html

@@ -26,7 +26,10 @@
 				</p>
 				{{- end }}
 				<p><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-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>{{ .WordCount }} Words</p>
-				<p><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-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat .Site.Params.dateformFull .Date.Local }}</p>
+				<p><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-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>{{ dateFormat .Site.Params.dateformNumTime .Date.Local }}</p>
+				{{- if .GitInfo }}
+				<p><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-git-commit"><circle cx="12" cy="12" r="4"></circle><line x1="1.05" y1="12" x2="7" y2="12"></line><line x1="17.01" y1="12" x2="22.96" y2="12"></line></svg><a href="https://github.com/Track3/my-hugo-blog/commit/{{ .GitInfo.Hash }}">{{ .GitInfo.AbbreviatedHash }}</a> @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}</p>
+				{{- end }}
 			</footer>
 		</article>
 		<div class="post-nav thin">