Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add read-more to summary #198

Merged
merged 3 commits into from
Jun 14, 2020
Merged

Add read-more to summary #198

merged 3 commits into from
Jun 14, 2020

Conversation

yusbk
Copy link
Contributor

@yusbk yusbk commented Jun 13, 2020

Read-more isn't shown at home-posts when summary is specified in the post front-matter. Add partial read-more.html to the summary.html

@@ -13,9 +13,7 @@ <h2 class="post-title">
{{ partial "utils/summary.html" . }}
</summary>
{{ if .Truncated }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we can solve this issue simply by adding a or condition, {{ if or .Truncated .Params.summary }}.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems to be the better solution.

@reuixiy
Copy link
Owner

reuixiy commented Jun 14, 2020

Also, the summary.html partial is not just used by home-posts, it's also used by index.sectionsatom.xml, index.sectionsrss.xml, head.html, and post-share.html.

But the changes you made reminds me that maybe we should add read more to Atom and RSS too.

/cc @palant

Copy link
Collaborator

@palant palant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summary.html is also used for <meta name="description"> for example if no explicit description is set. So having "read more" in the partial definitely makes no sense. Also, the current change will result in "read more" being shown even for short posts where the summary is all of the post.

As to having a "Read more" link in RSS and Atom - I looked through the blogs I subscribed in the past, and showing summary only in RSS is definitely very uncommon. Found only three commercial sites doing it, all private blogs went for full post in RSS with no exception. Out of the commercial sites, one has something resembling a "Read more" link. So I'm inclined to say: not worth the effort.

@@ -13,9 +13,7 @@ <h2 class="post-title">
{{ partial "utils/summary.html" . }}
</summary>
{{ if .Truncated }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that seems to be the better solution.

layouts/partials/pages/home-posts.html Outdated Show resolved Hide resolved
Only when summary exists in font-matter
@yusbk
Copy link
Contributor Author

yusbk commented Jun 14, 2020

Made the changes accordingly. Should have checked the consequences of the proposed partial :-(

@palant palant self-requested a review June 14, 2020 13:25
Copy link
Collaborator

@palant palant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the indentation change, looks good to me now.

@reuixiy reuixiy merged commit 831d8fb into reuixiy:master Jun 14, 2020
@reuixiy
Copy link
Owner

reuixiy commented Jun 14, 2020

Thanks!

ulmefors pushed a commit to ulmefors/hugo-theme-meme that referenced this pull request Nov 22, 2020
Read-more isn't shown at home-posts when summary is specified in the post front-matter.

Co-authored-by: Yusman Kamaleri <ybkamaleri@gmail.com>
Co-authored-by: Wladimir Palant <fqcgithub@palant.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants