-
Notifications
You must be signed in to change notification settings - Fork 207
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 "html_excerpts" flag to allow Atom <summary> tags to contain HTML #397
Open
Kronopath
wants to merge
8
commits into
jekyll:master
Choose a base branch
from
Kronopath:html-excerpts
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The test checks this by verifying that the newlines in the "pre" post are converted to spaces.
This allows posts with autogenerated excerpts (that may have images or HTML in them) to keep that HTML intact in the summary portion of the Atom feed. The default remains as having the HTML be stripped and the whitespace normalized. This has some benefits, because the default value for a post excerpt is for it to be the entire first paragraph of each post. It's not unheard of for it to have plenty of HTML formatting and other tags. In [my site][1], for example, post excerpts often have images, and I'd very much prefer keeping those images intact in the feed, even if using `excerpt_only` feed generation. Note that this passes the W3C validator with no warnings, since feed.xml already uses `type="html"` in its `<summary>` tags. [1]: https://www.kronopath.com/blog/
This naming is more consistent with the "excerpts_only" flag, though it may be slightly more confusing given that this also applies to the post's "description" option. Still, consistency is key.
Also I'm aware that this somewhat conflicts with my other changes in #396. Happy to resolve those conflicts later on. |
Apparently some of the test cases are failing because instead of the "pre" post being tested, it's instead picking up the "liquid" post from just before it. I suspect that this might be happening because the test machines are maybe configured with a date and time before 2016-04-25, meaning that they don't pick up the "author-reference" post, leading to an off-by-one error. That's my best guess, anyway. It's not the most robust answer, since it would also likely mean that in these machines the "puts the latest 2 the posts in the feed.xml file" test would also fail. So maybe I'm wrong. Still, to try to fix this, instead of counting the posts from the most recent, the test now instead counts from the oldest, which should hopefully be more robust to this issue.
Apparently the indices just aren't consistent on jekyll-feed's test machines. Neither `feed.items[3]` nor `feed.items[-7]` can be reliably said to be the "pre" post which I use for testing in this PR. Instead, let's just search through all the posts for whichever one is titled "Pre" and test against that one.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This option should be useful in feeds where the summaries have more complex content or formatting, such as when the post's
description
andexcerpt
front matter options are not set, causing Jekyll to use the entire first paragraph of the post as the excerpt.It pairs really well with
excerpts_only
for sites which may not want to put the entirety of each post's content in the feed, but who want to preserve the excerpt's rich formatting and content.In my site, for example, post excerpts often have images. Its feed currently contains the entire post content, but I'm considering switching it to
excerpts_only
, and I'd very much prefer keeping those images intact in the feed if I do switch.Note that this passes the W3C validator with no warnings, since feed.xml already uses
type="html"
in its<summary>
tags. And since it's an option, and not a change in the default behaviour, it shouldn't break existing content.This PR also comes complete with tests and documentation!