Skip to content

Commit c333cc1

Browse files
authored
Merge pull request #191 from ludstuen90/183-featuredimage
Add ability to include featured images
2 parents dfaf768 + 8cc5bd5 commit c333cc1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

content/edit-this-site/edit-a-page.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ We also have a custom `{{</* iframe */>}}` shortcode that accepts `src` and _CSS
8181
{{</* iframe src="https://foo.bar" width="100%" height="300px" */>}}
8282
```
8383

84+
#### Adding a featured image
85+
It's possible to add a featured image to a page by includig its information in the metadata of the page. The following two parameters must be added to include a featured image:
86+
image: The URL to where the featured image is hosted
87+
image_caption: This is the caption that should appear beneath the featured image.
88+
8489
[1]: https://github.com/hackshackers/hackshackers-hugo-content
8590
[2]: https://gohugo.io
8691
[3]: https://guides.github.com/features/mastering-markdown/

themes/hackshackers-2017/layouts/_default/single.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ <h2 class="single-headline">{{ .Title }}</h2>
2727
{{ partial "utils/suggest-edits.html" . }}
2828

2929
<article class="single-article">
30+
31+
{{ if eq .Type "news" }}
32+
{{ if .Params.image }}
33+
<img src="{{ .Params.image }}">
34+
<p><i>{{ .Params.image_caption }}</i></p>
35+
{{ end }}
36+
{{ end }}
3037
{{ .Content }}
3138
</article>
3239

0 commit comments

Comments
 (0)