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

Generate full content on RSS instead of only summary #66

Closed
vinay-keshava opened this issue Sep 20, 2023 · 22 comments · Fixed by #75
Closed

Generate full content on RSS instead of only summary #66

vinay-keshava opened this issue Sep 20, 2023 · 22 comments · Fixed by #75
Labels
enhancement New feature or request

Comments

@vinay-keshava
Copy link

vinay-keshava commented Sep 20, 2023

I've used the template repository to create a hugo site and the index.xml doesn't generate full contents it only generates summary
Help or insight needed on this !

Enable Full Text RSS feed

this is an example site which generates full content which enhances readability in RSS
https://blog.sahilister.in/index.xml

@imfing
Copy link
Owner

imfing commented Sep 20, 2023

it's generating the full content in the RSS feed, for example, the blog section
https://imfing.github.io/hextra/blog/index.xml

and RSS is enabled here in the docs site for sections:

outputs:
home: [HTML]
page: [HTML]
section: [HTML, RSS]

@vinay-keshava
Copy link
Author

image
i've added the above config to hugo.yaml
still the whole content is not shown on RSS

@imfing
Copy link
Owner

imfing commented Sep 21, 2023

try localhost:1313/blog/index.xml
it should contain the full content RSS feed

@vinay-keshava
Copy link
Author

i tried it for blog/ and docs/ too

@imfing
Copy link
Owner

imfing commented Sep 21, 2023

I'll look into this. It would be nice if you could share an example repository for reproducing the issue.

@hugo-sid
Copy link
Contributor

hugo-sid commented Sep 21, 2023

AFAIK, unless a custom RSS template is specified, Hugo includes only a summary of an article (or blog post) in RSS feed. This is due to <description>{{ .Summary | html }}</description> in the default RSS template.

To include full post content in feed, a custom RSS template should be defined with .Content (instead of .Summary).

INMHO, it would be better to introduce a switch that allows controlling this feature (displaying full posts in the RSS feed) through a configuration parameter, with 'summary' as the default setting. Here is an example where this is implemented: hugo-sid/hugo-blog-awesome#113.

@imfing
Copy link
Owner

imfing commented Sep 21, 2023

AFAIK, unless a custom RSS template is used, Hugo includes only a summary of the article in RSS feed. This is due to the <description>{{ .Summary | html }}</description> in the default RSS template.

To include the full post content in feed, a custom RSS template should be defined with .Content (instead of .Summary).

INMHO, it's better to provide a switch to control this feature (full post in RSS feed) via one of the config parameters. Here is an example where this is implemented: hugo-sid/hugo-blog-awesome#113.

@hugo-sid Thanks for the info.

FYI, I have implemented full content RSS in layouts/section/section.rss.xml for sections like blog, but the contents are not placed in the description tags.

If the OP wants descriptions tag, then the only way is to override the RSS template.

@hugo-sid
Copy link
Contributor

hugo-sid commented Sep 21, 2023

Thanks for the info @imfing.

FYI, I have implemented full content RSS in layouts/section/section.rss.xml for sections like blog, but the contents are not placed in the description tags.

Yes, I saw that just now.

If the OP wants descriptions tag, then the only way is to override the RSS template.

Agree.

BTW, this is what I see at https://imfing.github.io/hextra/blog/index.xml :

image

@imfing
Copy link
Owner

imfing commented Sep 21, 2023

BTW, this is what I see at https://imfing.github.io/hextra/blog/index.xml

@hugo-sid I was aware of this, basically it lacks the xmlns:content="http://purl.org/rss/1.0/modules/content/" attribute on <rss>

I will create a PR to fix a couple of things for the RSS feed.

@imfing imfing added the enhancement New feature or request label Sep 22, 2023
@imfing
Copy link
Owner

imfing commented Sep 22, 2023

@hugo-sid I've created a PR #75 the RSS feed xml is parsed correctly by the browser now:
https://deploy-preview-75--hugo-hextra.netlify.app/blog/index.xml

@hugo-sid
Copy link
Contributor

@hugo-sid I've created a PR #75 the RSS feed xml is parsed correctly by the browser now: https://deploy-preview-75--hugo-hextra.netlify.app/blog/index.xml

Great!

@vinay-keshava
Copy link
Author

vinay-keshava commented Oct 10, 2023

Great
https://github.com/vinay-keshava/blog
this is the link to my site,i've also updated the hugo.yaml to generate rss
but gives a 404 for both blog
Have used the template repository

@imfing
Copy link
Owner

imfing commented Oct 10, 2023

Please rename contents/posts to contents/blog

otherwise access it using /posts

@vinay-keshava
Copy link
Author

Please rename contents/posts to contents/blog

otherwise access it using /posts

image

i have renamed it to blog/
now it says
XML Parsing Error: prefix not bound to a namespace
Location: http://localhost:1313/blog/index.xml
Line Number 17, Column 7:

for both blog/index.xml and docs/index.xml

@imfing
Copy link
Owner

imfing commented Oct 10, 2023

Can you also update the theme version please?

@vinay-keshava
Copy link
Author

Can you also update the theme version please?

in go.mod

module github.com/imfing/hextra-starter-template

go 1.21

require github.com/imfing/hextra v0.5.0 // indirect

@vinay-keshava
Copy link
Author

vinay-keshava commented Oct 10, 2023

Can you also update the theme version please?

in go.mod

image

after updating the version the theme version docs/ directory generates rss but not blog/(have pushed the changes to the repo)

module github.com/imfing/hextra-starter-template

go 1.21

require github.com/imfing/hextra v0.5.0 // indirect

@imfing
Copy link
Owner

imfing commented Oct 10, 2023

You may need to create a _index.md file under the blog section.

Please follow the exampleSite provided in this repository

@vinay-keshava
Copy link
Author

You may need to create a _index.md file under the blog section.

Please follow the exampleSite provided in this repository

Its still the same even after adding the _index.md
i've followed the exampleSite in this repository.

@imfing
Copy link
Owner

imfing commented Oct 11, 2023

@vinay-keshava I took a quick look of your repo, there are two issues:

  1. Please remove the type: post from your blog posts files, it's gonna mess up how Hugo looks up for template. I think this is the main reason why the RSS feed not showing the full content. https://github.com/vinay-keshava/blog/blob/6045e00579d0fad578ac217a40e87ff17eea044b/content/blog/contributing-to-debian.md?plain=1#L6

after remove the frontmatter, the RSS content shows up:
image

  1. This reference of the next page won't work: https://github.com/vinay-keshava/blog/blob/6045e00579d0fad578ac217a40e87ff17eea044b/content/docs/_index.md?plain=1#L3 it prevents the site from compiling. You need to replace it with next: blog/interception-vimproved

@vinay-keshava
Copy link
Author

@imfing thanks a lot for helping,i was a noob at hugo.
Fixed these issues and it started working

@imfing
Copy link
Owner

imfing commented Oct 11, 2023

@vinay-keshava no problem, this might also help people who may encounter the same problem in the future 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants