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

Strip html from feed description/summary #46

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

Conversation

daiyi
Copy link
Contributor

@daiyi daiyi commented Dec 1, 2016

Using nunjucks striptags to remove formatting that was messing with rss/atom description/summary tag.

Before:

<h2 id="I-am-exactly-as-cool-as-I-was-before-I-started-writing-clojure"><a href="#I-am-exactly-as-cool-as-I-was-before-I-started-writing-clo

After:

I am exactly as cool as I was before I started writing clojure.I’ve had a short, short life as a programmer and I’ve spent a lot of it...

@coveralls
Copy link

coveralls commented Dec 1, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling dbc38e0 on daiyitastic:daiyi/update-rss2 into f1977f8 on hexojs:master.

@erikman
Copy link

erikman commented Apr 4, 2019

I'm also interested in this, currently we can get a break in the middle of an html tag and this causes incorrect xml (e.g. the default hello world post from hexo):

<summary type="html">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo
</summary>

@tomap
Copy link
Contributor

tomap commented Jul 9, 2019

Hi, this has been partially done in more recent version =>

{% if post.description %}
      {{ post.description }}
    {% elif post.intro %}
      {{ post.intro }}
    {% elif post.excerpt %}
      {{ post.excerpt | striptags }}

but if there are no excepts or intro or description, then the post content is used, but no striptags
I don't know how to modify the code to fix that

{% set short_content = striptags(post.content).substring(0, config.feed.content_limit) %} ?

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