Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lgaida/mediumish-gohugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLenard Gaida <lenard.gaida@valtech.com>2019-10-04 22:34:48 +0300
committerLenard Gaida <lenard.gaida@valtech.com>2019-10-04 22:34:48 +0300
commit219714193758b30dd6feec8ff6e4650a596b731e (patch)
treed96164a04d31c8f16ccaf61d721fdcc00618d9a3
parentbd8907e9344aeec2b2b414eb981d4a63edded0fb (diff)
make use of page bundles
-rw-r--r--README.md12
-rw-r--r--archetypes/default.md3
-rw-r--r--layouts/_default/single.html7
-rw-r--r--layouts/partials/list-partials/postbox.html5
4 files changed, 15 insertions, 12 deletions
diff --git a/README.md b/README.md
index 7731b66..33ced75 100644
--- a/README.md
+++ b/README.md
@@ -27,23 +27,26 @@ Inside the folder of your Hugo site run:
$ git clone https://github.com/lgaida/mediumish-gohugo-theme
## Preface
-Most image files should be placed somewhere within the `static` folder of your gohugo website. This allows them to be easily referenced from the config.toml or post.md files. You may structure the files and folders within `static` however you'd like, with one exception: There must be a file named `jumbotron.jpg` present under the path `static/images` as it is referenced in the .css.
+I recommend placing image files for your site config within the `static` folder of your gohugo website. This allows them to be easily referenced from the config.toml or post.md files. You may structure the files and folders within `static` however you'd like, with one exception: There must be a file named `jumbotron.jpg` present under the path `static/images` as it is referenced in the .css.
## Post Example
To create a simple post use the hugo new command as usual.
+This theme makes use of page bundles / page resource (see https://gohugo.io/content-management/page-bundles/).
+Place any image next to your post's index.md file and make sure it contains the keyword "cover" inside its name.
+This image will also be used for twitter and opengraph cards.
+
```
-hugo new blog/my-first-post.md
+hugo new blog/my-first-post/index.md
```
-You then have a few options which i want to point out in the following.
+Creating a new post will create something like this:
```
---
title: "My first post"
date: 2018-10-01T15:25:19+02:00
publishdate: 2018-10-07T11:17:14+02:00
lastmod: 2018-10-08T18:55:29+02:00
-image: "/images/Test.jpg"
tags: ["post", "interesting"]
type: "post"
comments: false
@@ -54,7 +57,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean semper libero qu
`publishdate`: is displayed at the top of the single-view\
`lastmod`: is displayed as a hint on the single-view\
-`image`: is displayed in the list- and single-view\
`tags`: are used as usual, just add the tags you want to use. They are displayed in the jumbotron on the list-view, and on the bottom of each single-view\
`comments`: true/false to turn on/off disqus-comments
diff --git a/archetypes/default.md b/archetypes/default.md
index 1ff17ca..83d08ba 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -2,8 +2,7 @@
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
publishdate: {{ .Date }}
-image: ""
-tags:[]
+tags: []
comments: true
draft: true
---
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 05fd080..06387c7 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -43,11 +43,12 @@
</div>
<!-- Post Featured Image -->
- {{with .Params.image}}
- <img class="featured-image img-fluid" src="{{ . | urlize | relURL }}" alt="thumbnail for this post">
+ {{$images := .Resources.ByType "image"}}
+ {{with $images.GetMatch "*cover*" }}
+ <img class="featured-image img-fluid" src="{{ .Permalink }}" alt="thumbnail for this post">
{{end}}
<!-- End Featured Image -->
-
+
<!-- Post Content -->
<div class="article-post">
{{ .Content}}
diff --git a/layouts/partials/list-partials/postbox.html b/layouts/partials/list-partials/postbox.html
index 5aafddd..02fc5c3 100644
--- a/layouts/partials/list-partials/postbox.html
+++ b/layouts/partials/list-partials/postbox.html
@@ -3,8 +3,9 @@
<div class="card h-100">
<div class="maxthumb">
<a href="{{ .URL }}">
- {{with .Params.image}}
- <img class="img-fluid" src="{{ . | urlize | relURL }}" alt="A thumbnail image">
+ {{$images := .Resources.ByType "image"}}
+ {{with $images.GetMatch "*cover*" }}
+ <img class="img-fluid" src="{{ .Permalink }}" alt="A thumbnail image">
{{end}}
</a>
</div>