Просмотр исходного кода

Add an optional featured image (#252)

* Make MathJax version 3 work

* Change my contributor link

* Add an optional featured image and table of contents

* Add an optional featured image and table of contents

* Add example of a featured image in post along with table of contents

* Remove word count criteria

* Fix formatting

* Add table of contents options

* Remove toc feature due to markdown bug

* Removing markup configuration

Co-authored-by: Luiz F. A. de Prá <luizdepra@users.noreply.github.com>
Bobby 6 лет назад
Родитель
Сommit
be94b5fd05
2 измененных файлов с 5 добавлено и 0 удалено
  1. 1 0
      exampleSite/content/posts/hugoisforlovers.md
  2. 4 0
      layouts/posts/single.html

+ 1 - 0
exampleSite/content/posts/hugoisforlovers.md

@@ -12,6 +12,7 @@ categories = [
     "golang",
 ]
 series = ["Getting Started", "Hugo"]
+featured_image = "https://imgs.xkcd.com/comics/angular_momentum.jpg"
 +++
 
 ## Step 1. Install Hugo

+ 4 - 0
layouts/posts/single.html

@@ -27,9 +27,13 @@
       </header>
 
       <div>
+        {{ if .Params.featured_image }}
+          <img src='{{ .Params.featured_image }}' alt="Featured image"/>
+        {{ end }}
         {{ .Content }}
       </div>
 
+
       <footer>
         {{ partial "posts/series.html" . }}
         {{ partial "posts/disqus.html" . }}