瀏覽代碼

feat: add support for Terms in footer (#1236)

To use, copy `themes/academic/exampleSite/content/terms.md` to `content/terms.md` in your site, add your legal terms, and remove the `draft` option to publish.
Julian Pawlowski 6 年之前
父節點
當前提交
8272c2c8fb
共有 2 個文件被更改,包括 21 次插入2 次删除
  1. 13 0
      exampleSite/content/terms.md
  2. 8 2
      layouts/partials/site_footer.html

+ 13 - 0
exampleSite/content/terms.md

@@ -0,0 +1,13 @@
+---
+title: Terms
+date: "2018-06-28T00:00:00+01:00"
+draft: true
+share: false
+
+# Optional header image (relative to `static/img/` folder).
+header:
+  caption: ""
+  image: ""
+---
+
+...

+ 8 - 2
layouts/partials/site_footer.html

@@ -1,7 +1,13 @@
 <footer class="site-footer">
-  {{ with site.GetPage "privacy.md" }}
+  {{ if or (site.GetPage "terms.md") (site.GetPage "privacy.md") }}
   <p class="powered-by">
-    {{ printf "<a href=\"%s\">%s</a>" .RelPermalink .Title | safeHTML }}
+    {{ with site.GetPage "privacy.md" }}
+      {{ printf "<a href=\"%s\">%s</a>" .RelPermalink .Title | safeHTML }}
+    {{ end }}
+    {{ with site.GetPage "terms.md" }}
+      {{ if site.GetPage "privacy.md" }} &middot; {{ end }}
+      {{ printf "<a href=\"%s\">%s</a>" .RelPermalink .Title | safeHTML }}
+    {{ end }}    
   </p>
   {{ end }}