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

feat(docs): adding an RSS Feed #11941

Merged
merged 13 commits into from
Feb 25, 2019
Merged

feat(docs): adding an RSS Feed #11941

merged 13 commits into from
Feb 25, 2019

Conversation

marcysutton
Copy link
Contributor

Description

When I set up an RSS feed for my website, I found some critical information was missing from the gatsby-plugin-feed README. I also didn't see a doc for creating an RSS feed, so I added one. That's what this PR does, in addition to some title case updates to doc-links.yml while I was in there.

@marcysutton marcysutton requested a review from a team February 20, 2019 21:37
@marcysutton marcysutton requested a review from a team as a code owner February 20, 2019 21:37
@DSchau DSchau changed the title Docs: Adding an RSS Feed feat(docs): adding an RSS Feed Feb 20, 2019
Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

This is really great, thanks for adding it!

docs/docs/adding-an-rss-feed.md Outdated Show resolved Hide resolved
docs/docs/adding-an-rss-feed.md Outdated Show resolved Hide resolved
docs/docs/adding-an-rss-feed.md Outdated Show resolved Hide resolved
packages/gatsby-plugin-feed/README.md Outdated Show resolved Hide resolved
@KyleAMathews
Copy link
Contributor

The plugin should be fixed so "fields.slug" isn't required. You should be able to specify that directly. Lots of people will have the URL elsewhere.

@LekoArts
Copy link
Contributor

Just as an idea: What about i18n and RSS feeds?

@marcysutton
Copy link
Contributor Author

@LekoArts I love the idea! Since there isn't much on i18n currently, I think that addition could come later after this doc is merged.

@marcysutton
Copy link
Contributor Author

Ok, this PR is ready! I had to fix some permalinks in my own feed to get a full understanding of what was going on. In short, I have custom path entries in content frontmatter to match my old site
URLs, and I needed to use those instead of createFilePath. That and use my-blog-post/index.md instead of my-blog-post/2019-01-04-my-blog-post.md in named content directories. All good now 😜

For the post, I kept the customization details simple based on your feedback and added an "ask us for help!" callout in case anyone gets stuck. Given Wordpress generates RSS automatically, we should make this as easy to figure out as possible.

I'll file an issue to look into i18n for RSS. Thanks for the suggestions!

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

Looks great - one request to change the plugin structure/name!


To customize the default feed schema (a.k.a. structure) output by the plugin to work with your website's content, you can start with the following code:

```json:title=gatsby.config.js
Copy link
Contributor

Choose a reason for hiding this comment

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

This is js!

Would generally recommend doing something like:

```js:title=gatsby-config.js
module.exports = {
 plugins: [
   // your code block
 ]
}
```

just so we can show it as real-world as possible!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!


To see your feed in action, run `gatsby build && gatsby serve` and you can then inspect the content and URLs in your RSS file at `http://localhost:9000/rss.xml`.

> NOTE: if your blog has custom permalinks, such as links with or without dates in them, you may need to [customize `gatsby-node.js`](https://github.com/gatsbyjs/gatsby-starter-blog/blob/master/gatsby-node.js#L57) to output the correct URLs in your RSS feed. [Get in touch with us](/contributing/how-to-contribute/) if you need any help!
Copy link
Contributor

Choose a reason for hiding this comment

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

Like this pattern a lot!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seriously, when I was learning to build websites I would have loved this. I felt bad always pestering my one friend who knew how everything worked...having a whole community available would have been amazing.

Copy link
Contributor

@DSchau DSchau left a comment

Choose a reason for hiding this comment

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

Looks great to me! I'll let you do the honors of merging 🎉

@marcysutton marcysutton merged commit 0d7449d into master Feb 25, 2019
@marcysutton marcysutton deleted the docs-rss-feed branch February 25, 2019 22:39
title
description
siteUrl
site_url: siteUrl
Copy link
Contributor

Choose a reason for hiding this comment

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

any explanation why this additional site_url is needed?

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.

5 participants