mirror of
https://github.com/thomasjsn/hugo-theme-hello-friend.git
synced 2024-11-22 07:45:08 +01:00
Merge pull request #44 from mpaepper/master
Implemented the possibility to use a relative cover image as well
This commit is contained in:
commit
af6f549dd9
10
README.md
10
README.md
@ -15,6 +15,7 @@ This theme is pretty basic and covers all of the essentials. All you have to do
|
||||
- [Code highlighting](#code-highlighting)
|
||||
- [How to start](#how-to-start)
|
||||
- [How to configure](#how-to-configure)
|
||||
- [How to add a cover image to your posts](#how-to-add-a-cover-image-to-your-posts)
|
||||
- [Add-ons](#add-ons)
|
||||
- [How to run your site](#how-to-run-your-site)
|
||||
- [How to edit the theme](#how-to-edit-the-theme)
|
||||
@ -123,6 +124,15 @@ to `config.toml` file in your Hugo root directory and change params fields. In c
|
||||
|
||||
**NOTE:** Please keep in mind that currently main menu doesn't support nesting.
|
||||
|
||||
## How to add a cover image to your posts
|
||||
|
||||
Adding a cover image to your post is simple and there are two options when you edit your `index.md` file in `content/posts/blog-entry-xy/index.md`:
|
||||
|
||||
* Use `cover: "/path/to/absolute/img.jpg"` to link an absolute image
|
||||
* Resulting in `https://www.yourpage.com/path/to/absolute/img.jpg`
|
||||
* Use `cover: "img.jpg"` and `useRelativeCover: true` to link the image relative to the blog post folder
|
||||
* Resulting in `https://www.yourpage.com/posts/blog-entry-xy/img.jpg`
|
||||
|
||||
## Add-ons
|
||||
|
||||
- **Comments** — for adding comments to your blog posts please take a look at `layouts/partials/comments.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/comments.html.
|
||||
|
@ -26,8 +26,12 @@
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.Cover }}
|
||||
<img src="{{ . | absURL }}" class="post-cover" />
|
||||
{{ if .Params.Cover }}
|
||||
{{ if .Params.UseRelativeCover }}
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" class="post-cover" />
|
||||
{{ else }}
|
||||
<img src="{{ (urlize .Params.Cover | absURL) }}" class="post-cover" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="post-content">
|
||||
|
@ -21,8 +21,12 @@
|
||||
</span>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.Cover }}
|
||||
<img src="{{ . | absURL }}" class="post-cover" />
|
||||
{{ if .Params.Cover }}
|
||||
{{ if .Params.UseRelativeCover }}
|
||||
<img src="{{ (printf "%s%s" .Permalink .Params.Cover ) }}" class="post-cover" />
|
||||
{{ else }}
|
||||
<img src="{{ (urlize .Params.Cover | absURL) }}" class="post-cover" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
<div class="post-content">
|
||||
|
Loading…
Reference in New Issue
Block a user