Skip to content

Commit

Permalink
commit fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
swyxio committed Mar 15, 2020
1 parent fb85278 commit ffda4a4
Show file tree
Hide file tree
Showing 10 changed files with 2,248 additions and 22 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ You define a folder, the plugin recursively scans everything inside, sorts by pu

This plugin uses [Cheerio](https://github.com/cheeriojs/cheerio) to extract data from your HTML, so you can use jQuery/CSS selectors to customize how to extract your content, title, publish date, and description metadata per item.

See our [Fixtures](/fixtures/publishDir) for example of generated RSS from a `/blog` folder with nested html files.

## Usage

Specify the plugin in your `netlify.yml`. No config is required but we show the default options here.
Expand All @@ -30,25 +32,25 @@ plugins:
rssDescription: 'swyx.io RSS Feed'
categories: "['Technology', 'JAMstack', 'Web Development]"

# optional configs, defaults shown
rssFaviconUrl: 'https://swyx.io/favicon.png'
docs: 'http://example.com/rss/docs.html'
managingEditor: authorName
webMaster: authorName
copyright: 2020 ${authorName}
language: 'en'
pubDate: new Date().toUTCString(),
ttl: '60' # aka refresh every hour

## cheerio selectors for extractMetadataFromFile
## defaults shown
contentSelector: 'main'
publishDateSelector: null #
descriptionSelector: 'meta[name=description]' # probably no need to change
titleSelector: 'meta[property="og:title"]' # probably no need to change

# developer configs
debugMode: false # (for development) turn true for extra diagnostic logging
# # optional configs, defaults shown
# rssFaviconUrl: 'https://swyx.io/favicon.png'
# docs: 'http://example.com/rss/docs.html'
# managingEditor: authorName
# webMaster: authorName
# copyright: 2020 ${authorName}
# language: 'en'
# pubDate: new Date().toUTCString(),
# ttl: '60' # aka refresh every hour

# # cheerio selectors for extractMetadataFromFile
# # defaults shown
# contentSelector: 'main'
# publishDateSelector: null #
# descriptionSelector: 'meta[name=description]' # probably no need to change
# titleSelector: 'meta[property="og:title"]' # probably no need to change

# # developer configs
# debugMode: false # (for development) turn true for extra diagnostic logging
```


Expand Down
41 changes: 41 additions & 0 deletions fixtures/__snapshots__/this.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`generateRSS works 1`] = `
"<?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[swyx RSS Feed]]></title><description><![CDATA[swyx.io RSS Feed]]></description><link>https://swyx.io</link><image><url>https://swyx.io/favicon.png</url><title>swyx RSS Feed</title><link>https://swyx.io</link></image><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2020 04:57:36 GMT</lastBuildDate><atom:link href=\\"https://swyx.io/rss.xml\\" rel=\\"self\\" type=\\"application/rss+xml\\"/><pubDate>Sun, 15 Mar 2020 04:57:36 GMT</pubDate><copyright><![CDATA[2020 swyx]]></copyright><language><![CDATA[en]]></language><managingEditor><![CDATA[swyx]]></managingEditor><webMaster><![CDATA[swyx]]></webMaster><docs>http://example.com/rss/docs.html</docs><ttl>60</ttl><category><![CDATA[Technology]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[React]]></category><category><![CDATA[Svelte]]></category><item><title><![CDATA[This is our First Post]]></title><description><![CDATA[or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call \\"the stack\\", one of many vague concepts web developers use when describing themselves. People call themselves \\"frontend\\", \\"backend\\" and \\"full stack\\" but there's no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the \\"stack\\" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther]]></description><link>https://swyx.io/../tests/generateRSS/publishDir/blog</link><guid isPermaLink=\\"true\\">https://swyx.io/../tests/generateRSS/publishDir/blog</guid><pubDate>Wed, 01 Jan 2020 05:00:00 GMT</pubDate><content:encoded><![CDATA[
<div class=\\"postDate\\">1 January, 2020</div>
<h1>This is our First Post</h1>
<div>
some words for our first post
</div>
]]></content:encoded></item><item><title><![CDATA[This is our Second Post]]></title><description><![CDATA[or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call \\"the stack\\", one of many vague concepts web developers use when describing themselves. People call themselves \\"frontend\\", \\"backend\\" and \\"full stack\\" but there's no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the \\"stack\\" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther]]></description><link>https://swyx.io/../../tests/generateRSS/publishDir/blog</link><guid isPermaLink=\\"true\\">https://swyx.io/../../tests/generateRSS/publishDir/blog</guid><pubDate>Sat, 01 Feb 2020 05:00:00 GMT</pubDate><content:encoded><![CDATA[
<div class=\\"postDate\\">1 February, 2020</div>
<h1>This is our Second Post</h1>
<div>
some words for our second post
</div>
]]></content:encoded></item><item><title><![CDATA[This is our Third Post]]></title><description><![CDATA[or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call \\"the stack\\", one of many vague concepts web developers use when describing themselves. People call themselves \\"frontend\\", \\"backend\\" and \\"full stack\\" but there's no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the \\"stack\\" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther]]></description><link>https://swyx.io/../../tests/generateRSS/publishDir/blog</link><guid isPermaLink=\\"true\\">https://swyx.io/../../tests/generateRSS/publishDir/blog</guid><pubDate>Sun, 01 Mar 2020 05:00:00 GMT</pubDate><content:encoded><![CDATA[
<div class=\\"postDate\\">1 March, 2020</div>
<h1>This is our Third Post</h1>
<div>
some words for our 3rd post
</div>
]]></content:encoded></item></channel></rss>"
`;
183 changes: 183 additions & 0 deletions fixtures/publishDir/blog/blog1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
<html lang="en" data-react-helmet="lang">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<link
rel="apple-touch-icon"
sizes="180x180"
href="/favicon/apple-touch-icon.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="/favicon/site.webmanifest" />
<meta name="generator" content="Gatsby 2.19.23" />
<link
rel="preconnect dns-prefetch"
href="https://www.google-analytics.com"
/>
<title>This is our First Post | Seldo.com</title>
<meta
data-react-helmet="true"
name="description"
content='or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call "the stack", one of many vague concepts web developers use when describing themselves. People call themselves "frontend", "backend" and "full stack" but there&apos;s no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the "stack" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther'
/>
<meta
data-react-helmet="true"
property="og:title"
content="This is our First Post"
/>
<meta
data-react-helmet="true"
property="og:description"
content='or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call "the stack", one of many vague concepts web developers use when describing themselves. People call themselves "frontend", "backend" and "full stack" but there&apos;s no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the "stack" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther'
/>
<meta data-react-helmet="true" property="og:type" content="website" />
<meta
data-react-helmet="true"
property="twitter:image:alt"
content="A beautiful photograph"
/>
<meta
data-react-helmet="true"
name="twitter:card"
content="summary_large_image"
/>
<meta data-react-helmet="true" name="twitter:site" content="@seldo" />
<meta
data-react-helmet="true"
name="twitter:title"
content="This is our First Post | Seldo.com"
/>
<meta
data-react-helmet="true"
name="twitter:description"
content='or, Career Advice For The Working Web Dev
I have been thinking a lot about the thing we call "the stack", one of many vague concepts web developers use when describing themselves. People call themselves "frontend", "backend" and "full stack" but there&apos;s no real consensus on what any of those mean.
What is the stack?
Part of the problem is that the "stack" is enormous: it includes at a minimum HTML, CSS and JavaScript. But how deep do you go? There are many server-side languages, ther'
/>
<link
rel="preload"
as="font"
type="font/woff2"
crossorigin="anonymous"
href="/google-fonts/s/firasans/v10/va9E4kDNxMZdWfMOD5Vvl4jL.woff2"
/>
<link
rel="preload"
as="font"
type="font/woff2"
crossorigin="anonymous"
href="/google-fonts/s/lato/v16/S6uyw4BMUTPHjx4wXg.woff2"
/>
<link
rel="alternate"
type="application/rss+xml"
title="Seldo.com RSS Feed"
href="/rss.xml"
/>
<link as="script" rel="preload" href="/styles-6317938c8d7b99f47be8.js" />
<link
as="script"
rel="preload"
href="/component---src-components-post-page-js-7cd9a2051a5b756943d9.js"
/>
<link as="script" rel="preload" href="/commons-415fccf307c3bd1dfc32.js" />
<link as="script" rel="preload" href="/app-9383dc4058dc6fd3048a.js" />
<link
as="script"
rel="preload"
href="/webpack-runtime-513e86d492ba6902f824.js"
/>
<link
as="fetch"
rel="preload"
href="/page-data/posts/you-will-never-be-a-full-stack-developer/page-data.json"
crossorigin="anonymous"
/>
<link
as="fetch"
rel="preload"
href="/page-data/app-data.json"
crossorigin="anonymous"
/>
<meta
property="twitter:image"
content="https://seldo.com/static/913882f97dc95a72f0a15ad9458b0447/1e72a/IMG_2791.jpg"
data-react-helmet="true"
/>
</head>

<body class="vsc-initialized">
<div id="___gatsby">
<div style="outline:none" tabindex="-1" id="gatsby-focus-wrapper">
<header>
<div class="headerLogo">
<h1>
<a href="/"><span>Seldo.com</span></a>
</h1>
</div>
</header>
<div class="mainContainer">
<main>
<div class="postPage">
<div class="singlePost flexyColumn">
<div class="postDate">1 January, 2020</div>
<h1>This is our First Post</h1>
<div>
some words for our first post
</div>
</div>
</div>
</main>
</div>
<footer>
<div>
© 2001 -
<!-- -->2020<!-- -->
Laurie Voss.
</div>
<div>
<a href="/">Home</a> | <a href="/about">About me</a> |
<a href="/archive">Archive</a>
</div>
</footer>
</div>
<div
id="gatsby-announcer"
aria-live="assertive"
aria-atomic="true"
style="position: absolute; top: 0px; width: 1px; height: 1px; padding: 0px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border: 0px;"
></div>
</div>
</body>
</html>
Loading

0 comments on commit ffda4a4

Please sign in to comment.