-
Notifications
You must be signed in to change notification settings - Fork 333
Hugo generated .Summary lacks manual cut-off in .Rmd #21
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
Comments
It looks like Blogdown knits to html, although the partials are properly processed features like summary and table of contents are not available. The <!--more-> processing command is included as a regular html comment. I modified my template to use description if available, because the first 70-words was messy.
|
@tovare Brilliant!! I had tried manually adding a .Summary field but hadn't thought to add a .Description! Works like a charm. Thank you! |
Right. It is up to the specific Hugo theme whether/how you can customize the summary. Some themes support the ---
title: "My Post"
summary: "A custom summary of my post."
--- |
@ProQuestionAsker Hi Amber, I am using the same theme you are using for your website/blog. Could you please tell me where to modify the template as @tovare suggested? |
@trefoil-ml You ever figure out where to modify the template? |
Sorry for the delay here @trefoil-ml and @lyons7 I had to add the description code as suggested by @tovare to both the "Portfolio" partial file and the "list" partial file. You'll find the updated versions in the repo for my site: Then you just add a
Hope that helps! |
Thank you so much @ProQuestionAsker! Works like a charm 🥇 |
The equivalent solution for the Replace line 44: {{ printf "%s" .Summary | markdownify }} with: {{if .Description }}
{{ printf "%s" .Description }}
{{ else }}
{{ printf "%s" .Summary | markdownify }}
{{ end }} |
@andrie -- thank you very much for the simple replacement solution for In case anyone finds this solution, for the current version Replace line 43:
with:
Edited to add: Per @SteveRxD, the following change (using the YAML parameter 'summary' instead of 'description', and I think applying markdown formatting processing) from here might be a better replacement consistent with future versions of
|
You guys are awesome! I could do the same proposed by @tovare, as explained by @ProQuestionAsker, in both files 'layouts/partials/recent_posts.html' and '/layouts/_default/list.html' for hugo-universal-theme. It works like a charm, thanks!! |
I want to request to reopen this issue because although the workarounds above allow for customizing the summary text, they still leave the following issue unresolved. One of the things that hugo does with the I am using the Jane theme and I wish the summaries to include header photos which means that we need to signal hugo with a @yihui I would be happy to provide examples and more details. |
@ProQuestionAsker, @yihui another approach I use with success that fullfills @mkhezr 's requirement to preserve the html is using My context is I use this to generate summaries for posts on index, where each post consists of a summary and then a content, divided by the standard
This uses regular expressions to
You could of course use any other string for the splitting, or any other pattern that better suits your needs as regular expressions are a very flexible tool. References: |
@jozefhajnala Many thanks for sharing your solution! |
While the Hugo-generated .Summary leaves much to be desired in terms of customization, it can be slightly modified in .md documents by adding a
<!--more-->
tag below content you wish to be included. This tag doesn't seem to work on blogdown-generated .Rmd files, causing the default summary to be the first 70 words of the post (which often includes the table of contents and other materials that aren't appropriate for a summary).This may be more of a Hugo issue than a blogdown one but it seemed appropriate to at least mention here.
The text was updated successfully, but these errors were encountered: