Skip to content

Commit

Permalink
📝 Document cover image
Browse files Browse the repository at this point in the history
Former-commit-id: 9939354 [formerly 44a1194]
Former-commit-id: 571c4f8d12b3756181f4817484c56473816885e4
Former-commit-id: 55363b0
  • Loading branch information
UtkarshVerma committed Jan 11, 2019
1 parent c45bea3 commit 17e696f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This theme is an upgraded version of the [Dream Theme](https://github.com/g1eny0
* "Cards" and "Posts" views for the home page
* twemoji rendering
* Table of contents for posts
* Hugo image processing for faster loading
* Random image background
* Multiple author support
* Disqus
Expand Down Expand Up @@ -137,6 +138,19 @@ You may also blur the background to a certain extent through the `bgBlur` variab
bgBlur = "0.2"
```

### Card covers
The covers for each post-card or card are processed by Dream Plus using [Hugo Image Processing](https://gohugo.io/content-management/image-processing) for faster website loading times. The lookup paths for the cover file are as stated below:
- Cards: In the bundle. For example, `/content/cards/<card>/cover.<any-extension>`
- Posts: In the images folder inside the bundle. For example, `/content/posts/<post>/images/cover.<any-extension>`

> **Specifying the cover image through the frontmatter has now been deprecated**.
You may also modify the image processing process through `coverArgs` variable in `[params.features]`. The arguments passed must be for the `.Resize` function since that's what Dream Plus utilizes. For example,
```toml
[params.features]
coverArgs = "400x300 q50" #Specify resolution and quality of output image
```

### Device detection
You may configure your website based on the client device by using the `isMobile` JS variable. It is `true` when the client device is a mobile and vice versa.

Expand Down
1 change: 0 additions & 1 deletion archetypes/cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: {{ replace .TranslationBaseName "-" " " | title }}
date: {{ .Date }}
lastmod: {{ .Date }}
cover:
draft: true
link: //enter the link to which this card will redirect to
weight:
Expand Down
1 change: 0 additions & 1 deletion archetypes/posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
title: {{ replace .TranslationBaseName "-" " " | title }}
date: {{ .Date }}
lastmod: {{ .Date }}
cover: "/images/default1.jpg"
draft: true
categories: ["category1"]
tags: ["tag1", "tag2"]
Expand Down
4 changes: 2 additions & 2 deletions layouts/cards/summary.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ $image := .Resources.GetMatch "cover.*" }}
{{ with $image }}
{{ with $.Site.Params.features.coverDimensions }}
{{ $.Scratch.Set "args" $.Site.Params.features.coverDimensions }}
{{ with $.Site.Params.features.coverArgs }}
{{ $.Scratch.Set "args" $.Site.Params.features.coverArgs }}
{{ else }}
{{ $.Scratch.Set "args" "420x270" }}
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/posts/summary.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ $image := .Resources.GetMatch "images/cover.*" }}
{{ with $image }}
{{ with $.Site.Params.features.coverDimensions }}
{{ $.Scratch.Set "args" $.Site.Params.features.coverDimensions }}
{{ with $.Site.Params.features.coverArgs }}
{{ $.Scratch.Set "args" $.Site.Params.features.coverArgs }}
{{ else }}
{{ $.Scratch.Set "args" "420x270" }}
{{ end }}
Expand Down

0 comments on commit 17e696f

Please sign in to comment.