Keeping drafts out of the rss feed

#1

I’ve followed the instructions for creating an rss.xml page found here so now my blog has been accepted to R-Bloggers.

Unfortunately, it is also showing all my posts which are still in draft form!

How do I set the rss so that it doesn’t publish the drafts?

Cheers!

#2

Are you publishing drafts to your live site?

I’m asking because, hugo has a flag -D, --buildDrafts, which can be used to show drafts in your lists and as single pages, but which if left off, will serve to cause hugo to hide those. If you build using that, yes, drafts will be included.

You can also store that as true in your config file, which means hugo will always show/build drafts.

#3

Thank you for your quick response :slight_smile:

To answer your question, no, I’m not publishing my drafts to my life site which is why I can’t figure out why they are showing up in the rss feed.

To that end, I know how to keep them off my live site by marking them as a draft in the yaml heading, but how can I keep them out of the rss feed?

Cheers!

#4

We have to see your code. Please read Requesting Help and share links. Then we’ll figure it out. :slight_smile:

#5

Thank you for your offer of assistance.

The repo for this blog is here, and here is the link to the theme: hugo-xmin.

Thank you once again and I look forward to your reply.

#6

Had a look at your RSS feed https://educators-r-learners.netlify.com/index.xml (using https://codebeautify.org/rssviewer) and there’s only one <item> entry in it. Where is the RSS feed which is revealing your draft posts?

(On another note, since you’re hosting on netlify you may want to look at using a submodule for your theme.)

#7

Using simplepie.org shows that the drafts are being published. Click here to see what I mean.

Also, I’ll be sure to look into using submodule. Thanks for the tip :+1:

#8

@educatorsRlearners how are you building your website? Because you are building drafts.

For instance, you have a post at https://educators-r-learners.netlify.com/post/2019/02/15/making-custom-maps/, whereas https://github.com/educatorsRlearners/weblog/blob/master/content/post/2019-02-15-making-custom-maps.markdown show draft: true.

What command do you run to produce your site? It seems to be building drafts on your site.

#9

Also, where does feed.xml come from? I think hugo normally builds the rss feed as index.xml (see https://gohugo.io/templates/rss/)

#10

That is a valid question! However, I suggest we defer it for now, and focus on getting drafts working as expected. As that may solve the issue. :slight_smile:

1 Like
#11

I’m building my site in R studio by pushing comments to github.

Additionally, and now that you ask I think this could be the problem, I’m previewing my site using “server site” and I’m guessing that when I do that for drafts, it is building a draft and storing it in the public folder.

Therefore, I’ve added public to gitignore in the hopes that it will stop building pages which are defined as drafts.