kentcdodds / old-kentcdodds.com

Kent's Homepage
http://kentcdodds.com
MIT License
736 stars 441 forks source link

Improve RSS feeds #18

Closed z0al closed 5 years ago

z0al commented 5 years ago

Hey Kent!

Congrats for the new website look, it looks cool :ok_hand:

Problem (s)

  1. The current RSS feeds at rss.xml, doesn't include the actual blog post content (see below).
  2. There are double / in all guids right after the base domain which (while works fine) could cause a tiny problem for RSS readers when you later (eventually ) fix it. So, I suggest to fix it now ;)
  3. PLEASE, set CORS to Access-Control-Allow-Origin: * for the feed URL so that client-side RSS reader users (like me) could access your posts.

Current behavior

<?xml version="1.0" encoding="UTF-8"?>
<rss
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>
      <![CDATA[Kent C. Dodds]]>
    </title>
    <description>
      <![CDATA[Come check out how Kent C. Dodds can help you level up your career as a software engineer.]]>
    </description>
    <link>https://kentcdodds.com</link>
    <generator>RSS for Node</generator>
    <lastBuildDate>Sun, 10 Feb 2019 15:55:45 GMT</lastBuildDate>
    <item>
      <title>
        <![CDATA[Testing Implementation Details]]>
      </title>
      <description>
        <![CDATA[Last year when I was using enzyme (like everyone else at the time), I stepped
carefully around certain APIs in enzyme. I
 completely avoided shallow rendering ,
 never  used APIs like  instance() ,  state() , or  find('ComponentName') . And
in code…]]>
      </description>
      <link>https://kentcdodds.com//blog/testing-implementation-details</link>
      <guid isPermaLink="false">https://kentcdodds.com//blog/testing-implementation-details</guid>
      <pubDate>Mon, 19 Nov 2018 00:00:00 GMT</pubDate>
    </item>
    <item>
      <title>
        <![CDATA[How to React]]>
      </title>
      <description>
        <![CDATA[This last week I gave
 a talk at called "How to React." 
It's basically an updated version of
 Pete Hunt's 
 react-howto  GitHub repo. I thought
I'd just jot down a few things from this talk for you to enjoy in your inbox
today :) Abstraction Let's…]]>
      </description>
      <link>https://kentcdodds.com//blog/how-to-react</link>
      <guid isPermaLink="false">https://kentcdodds.com//blog/how-to-react</guid>
      <pubDate>Mon, 16 Apr 2018 00:00:00 GMT</pubDate>
    </item>
  </channel>
</rss>

Expected behavior

I'd expect the RSS feed to include something like <content:encoded/> tag (since the necessary namespace is already declared ) that includes an encoded representation of the full post content. See Dan's blog for example.


Continue being awesome :)

kentcdodds commented 5 years ago

Thanks @z0al!

Would you be at all interested in contributing these improvements?

z0al commented 5 years ago

I'd love to, but no idea how Gatsby works.

May check it on the weekend if no one else did it already.

Regarding No. 3, I think that should be done on the server. Where do you host the website?

kentcdodds commented 5 years ago

I'm hosting on netlify. I'm sure there's a way to make that work. I'll have to look into it.

The feed is created here: https://github.com/kentcdodds/kentcdodds.com/blob/f043adfebfe3553390aa576998d3b30fa7afbb0b/gatsby-config.js#L119-L160

I'll bet we could just borrow a bunch from Dan's blog: https://github.com/gaearon/overreacted.io/blob/9d6fc2992a5070e6eb62f6ba5821266d31c7ec0b/gatsby-config.js#L77-L131

z0al commented 5 years ago

I'm hosting on netlify. I'm sure there's a way to make that work. I'll have to look into it.

I've done it a few days ago, but in my case, I've enabled it on all routes, all we need to do is adding a _headers file on the website root (so, it should go to static/ folder). Here is mine:

/*
    Access-Control-Allow-Origin: *

Ref doc: https://www.netlify.com/docs/headers-and-basic-auth/#multi-key-header-rules

The feed is created here

Thanks.

z0al commented 5 years ago

Ok, that turned out to be really easy. Will open a PR in a few minutes. Thanks for your help!