Add Preview Mode #227
pitscher
started this conversation in
Feature requests
Replies: 1 comment 1 reply
-
I just realized that it might make sense to relocate the preview badge. Please let me know if you would agree - will implement it accordingly. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry for pestering you @hugo-sid.
I am currently off my employers radar and wanted to use my vacation wisely (by supporting this theme). 😅
I got another cool idea/feature that others might like too - would appreciate your feedback (here too: #225) and a ping if you would like to see a PR.
A Preview Mode.
Use case: As an author one usually invests quite some time to write e.g. a new post. (from now on I only use "post", but this can be exchanged with any other word for a hugo content page.)
If I now want to tease my site visitors (to make them aware that a new post is about to be released) and show them only a part of what I got so far, I can use the preview mode.
This uses Hugo's
.Summary
feature (which works together with the special tag<!--more-->
).An author can decide how much of a post should be included in the preview (so that page visitors can see it).
Additionally, the author can configure an optional preview notice, e.g. to state what is about to come, the potential publish date, etc. .
A detailed explanation
Control this new feature site-wide with a simple config
The following block will be added to the sites
Params:
inhugo.yaml
:The following block will be added to the front matter of a content page (e.g.
/content/en/posts/markdown-syntax/index.md
):Example preview-enabled post // Front Matter view
--> Notice that the location of
<!--more-->
decides how much of the post visitors will be able to see.Example preview-enabled post // List view showing the badge
Preview-enabled post itself // Preview notice disabled
(The reading time is shown because I already implemented this feature. Here is the feature request, a PR can be created on a short notice: #225)
Preview-enabled post itself // Preview notice enabled
Disable the preview of a post (to actually publish it)
To finally publish a post that was previously only available as a preview, the author can simply update the
isPreviewEnabled: true
var in the front matter of the according post toisPreviewEnabled: false
.Beta Was this translation helpful? Give feedback.
All reactions