diff --git a/.eleventy.js b/.eleventy.js index d45c57cf0..7618b823f 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -73,14 +73,7 @@ module.exports = eleventyConfig => { eleventyConfig.addFilter('title_class', string => string.length > 30 ? ' is-long' : '') - eleventyConfig.addFilter('no_orphan', content => typogr(String(content)).chain().widont().value()) - - // eleventyConfig.addTransform('no_orphan', (content, outputPath) => { - // if( outputPath.endsWith(".html") ) { - // return typogr(content).chain().widont().value() - // } - // return content - // }) + eleventyConfig.addFilter('no_orphan', content => typogr(String(content)).chain().widont().value()) // Create Posts Collection eleventyConfig.addCollection('posts', collection => { @@ -157,6 +150,7 @@ module.exports = eleventyConfig => { eleventyConfig.addPassthroughCopy('src/A') eleventyConfig.addPassthroughCopy('src/CNAME') eleventyConfig.addPassthroughCopy('src/.nojekyll') + eleventyConfig.addPassthroughCopy('src/robots.txt') // More watched files eleventyConfig.addWatchTarget('./src/assets/js/**/*.js') diff --git a/.github/workflows/eleventy_build.yml b/.github/workflows/eleventy_build.yml index 42280df52..dece97a69 100644 --- a/.github/workflows/eleventy_build.yml +++ b/.github/workflows/eleventy_build.yml @@ -7,6 +7,8 @@ name: Build Eleventy on: push: branches: [ blog ] + schedule: + - cron: "00 20 * * 2" # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: diff --git a/src/_data/newsletter.js b/src/_data/newsletter.js index 0b6d7bfc2..787c2b7e3 100644 --- a/src/_data/newsletter.js +++ b/src/_data/newsletter.js @@ -1,28 +1,13 @@ -const https = require('https') +const axios = require('axios') -const url = 'https://api.jdsteinbach.com/newsletter/' +const url = 'https://api.jdsteinbach.com/.netlify/functions/newsletter' -const getNewsletter = () => { - return new Promise((resolve, reject) => { - https.get( - url, - res => { - let data = '' - - res.on('data', d => { - data += d - }) - - res.on('end', () => { - if(typeof data === 'string' && data.indexOf('<') === 0) throw new Error('ERROR: Newsletter API did not receive JSON.') - resolve(JSON.parse(data)) - }) - } - ).on('error', error => { - console.error(error) - reject(error) - }) +const getNewsletter = () => axios.get(url) + .then(({ data }) => { + return data + }) + .catch(error => { + console.error(error) }) -} module.exports = getNewsletter() diff --git a/src/_includes/partials/_head.liquid b/src/_includes/partials/_head.liquid index db696a7e0..f81938a66 100644 --- a/src/_includes/partials/_head.liquid +++ b/src/_includes/partials/_head.liquid @@ -48,4 +48,6 @@ + + diff --git a/src/_includes/sitemap.liquid b/src/_includes/sitemap.liquid new file mode 100644 index 000000000..d2821dc94 --- /dev/null +++ b/src/_includes/sitemap.liquid @@ -0,0 +1,16 @@ + + + {%- for post in collections.all %} + + {{ post.url | abs_url: site.url }} + + {{ post.date | rss_date }} + + {%- if post.data.changeFreq -%} + + {{ post.data.changefreq }} + + {%- endif -%} + + {%- endfor -%} + diff --git a/src/pages/feed.md b/src/pages/feed.md index 913fad65d..0189e3115 100644 --- a/src/pages/feed.md +++ b/src/pages/feed.md @@ -1,4 +1,5 @@ --- permalink: feed.xml layout: feed +eleventyExcludeFromCollections: true --- diff --git a/src/pages/sitemap.md b/src/pages/sitemap.md new file mode 100644 index 000000000..efbd175ee --- /dev/null +++ b/src/pages/sitemap.md @@ -0,0 +1,5 @@ +--- +permalink: sitemap.xml +layout: sitemap +eleventyExcludeFromCollections: true +--- diff --git a/src/pages/talks.md b/src/pages/talks.md index 384503e2c..bbe4f6c04 100644 --- a/src/pages/talks.md +++ b/src/pages/talks.md @@ -18,7 +18,7 @@ I enjoy writing here on the blog, but I really love speaking with real audiences * [Modal Windows for Everyone](https://jdsteinbach.com/a11y-modal-slides/#/) (Longer Version) / [Video](https://www.youtube.com/watch?v=kHqLKi1MwT4) * CascadiaJS 2020: [Modal Windows for Everyone](https://jdsteinbach.com/a11y-modal-slides/#/) / [Video](https://www.youtube.com/watch?v=UoIV6IWuJCY) * [A Practical Introduction to CSS Grid](https://jdsteinbach.com/intro-css-grid/#/) -* EmberConf 2020: [An Ember Dev's Guide to CSS Grid](https://jdsteinbach.com/emberconf-grid/#/) +* EmberConf 2020: [An Ember Dev's Guide to CSS Grid](https://jdsteinbach.com/emberconf-grid/#/) / [Video](https://www.youtube.com/watch?v=qAkRdaokkgI) * [Intro to Web Components](https://jdsteinbach.com/intro-web-components/#/) * EmberCamp 2019: [Content Choreography](https://jdsteinbach.com/ember-anim/#/) * Activate 2019: [A Practical Introduction to CSS Grid](https://jdsteinbach.com/intro-css-grid/#/) diff --git a/src/robots.txt b/src/robots.txt new file mode 100644 index 000000000..2708a1a9c --- /dev/null +++ b/src/robots.txt @@ -0,0 +1,4 @@ +Sitemap: https://jdsteinbach.com/sitemap.xml + +User-agent: * +Disallow: