Log in Sign up

Add page description to RSS feed?

So in my site's head I've added {{> description}} which will take the summary field from my front matter and add it to the page's HTML meta.

I'm trying to create a second RSS feed that, instead of containing the entire post contents, I'd like to have the page description from the meta and a link to the post. This is so I can use Micro.blog to automatically crosspost a summary, rather than the entire (poorly formatted) post.

So I've tried adding the following to my RSS file, but it isn't working:

<description>
     <![CDATA[ {{#encodeXML}} {{{description}}}  {{/encodeXML}} ]]>
</description>

I've also tried {{> description}} and {{{summary}}} but none are working.

How do I add the page description to this RSS feed?

Thanks.


2 years ago, 5 replies   developers   rss   Edit question

You should use {{> description}} and then make sure that the view for your new feed file has a corresponding description partial in your template's package.json file. See the one for your entry, as an example:

https://github.com/davidmerfield/Blot/blob/master/app/templates/latest/blog/package.json#L72

Answered 2 years ago · Edit answer

Bump. Anyone got any ideas please?

Answered 2 years ago · Edit answer

Thanks for the reply, but that didn't work unfortunately - I'm probably doing it wrong. Here's what I added to my package.json file:

    "social-feed.rss": {
      "partials": {
        "description": "{{{entry.summary}}}"
      }
    },

Then I added {{> description}} into the RSS feed, but it's just blank. :/

Answered 2 years ago · Edit answer

Ah! That was silly of me – try this instead in your new feed's template file:

<description>
     <![CDATA[ {{#encodeXML}} {{{summary}}}  {{/encodeXML}} ]]>
</description>
Answered 2 years ago · Edit answer

That worked like a charm, thanks!

Answered 2 years ago · Edit answer