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

Print full post content in RSS description #41

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tdemin
Copy link
Owner

@tdemin tdemin commented Oct 3, 2021

As gmnhg right now doesn't generate post summary, using post content as RSS post description source seems like our best bet. Right now gmnhg will generate RSS with empty descriptions.

As gmnhg right now doesn't generate post summary, using post content as
RSS post description source seems like our best bet. Right now gmnhg
will generate RSS with empty descriptions.
@tdemin tdemin added the gmnhg Issue related to cmd/gmnhg label Oct 3, 2021
@tdemin tdemin added this to the 0.5.0 milestone Oct 4, 2021
@tdemin tdemin added the rfc Up to discussion label Oct 4, 2021
@@ -79,7 +79,7 @@ var defaultRssTemplate = mustParseTmpl("rss", `{{- $Site := .Site -}}
<link>{{ $AbsURL }}</link>
<pubDate>{{ $p.Metadata.Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</pubDate>
<guid>{{ $AbsURL }}</guid>
<description>{{ html $p.Metadata.Summary }}</description>
<description>{{ printf "%s" $p.Post }}</description>
Copy link
Contributor

Choose a reason for hiding this comment

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

By default Hugo uses the post's "summary" front matter if it exists (that's what is loaded into Metadata.Summary), then it falls back to an auto-generated summary. It should be fine to put in the full post data since people can override the defaults, but I wanted to mention that here.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes, but the difference between us and Hugo is that Hugo autogenerates a summary unlike us.

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly. I write my own summaries and put it into the front matter (I don't particularly like Hugo's autogenerated summaries), but as long as Metadata.Summary remains available, I can make a custom template that uses the summary data. Or who knows, maybe I should use the default and put the whole post content into RSS.

Copy link
Owner Author

Choose a reason for hiding this comment

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

The thing I never thought of: since RSS is XML, raw post content which might contain XML has to be escaped.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, yep, gemtext may contain XML content. Passing it through the escaper should be enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gmnhg Issue related to cmd/gmnhg rfc Up to discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants