From 1a193da7baa85e119a9a2c2190404acb58c1a404 Mon Sep 17 00:00:00 2001 From: Russ Biggs Date: Wed, 28 Aug 2024 13:26:57 -0600 Subject: [PATCH] remove blog pages and link to medium instead --- themes/openaq/assets/js/blog.js | 40 ---------------------- themes/openaq/layouts/about/blog/list.html | 36 ------------------- themes/openaq/layouts/partials/header.html | 2 +- 3 files changed, 1 insertion(+), 77 deletions(-) delete mode 100644 themes/openaq/assets/js/blog.js delete mode 100644 themes/openaq/layouts/about/blog/list.html diff --git a/themes/openaq/assets/js/blog.js b/themes/openaq/assets/js/blog.js deleted file mode 100644 index c9cf52e3..00000000 --- a/themes/openaq/assets/js/blog.js +++ /dev/null @@ -1,40 +0,0 @@ -(async () => { - - const placeholder = document.querySelector('.placeholder-item'); - // placeholder is used to ensure classes are not purged by purgecss - placeholder.remove() - const list = document.querySelector('.items'); - const res = await fetch('https://medium.openaq.org').catch(() => { - const errorHtml = ` - - Failed to fetch blog items. Visit OpenAQ on Medium - `; - list.insertAdjacentHTML('beforeend', errorHtml); - return; - }); - const feed = await res.text(); - const data = new window.DOMParser().parseFromString(feed, "text/xml"); - const items = data.querySelectorAll("item"); - let year; - for (const item of items) { - const title = item.querySelector("title").innerHTML.match(/\<\!\[CDATA\[(.*)\]{2}\>/) - const publicationDate = new Date(item.querySelector("pubDate").innerHTML) - let content = item.getElementsByTagName('content:encoded'); - content = content[0].innerHTML.replace(/\.*\<\/figcaption\>/g, ' ') - const link = item.getElementsByTagName('link')[0].innerHTML - let html = ''; - if (publicationDate.getFullYear() != year) { - html += `

${publicationDate.getFullYear()}

`; - year = publicationDate.getFullYear(); - } - html += `
- ${publicationDate.toLocaleDateString('en-us', { month:"long", day:"numeric"})} -
-
${title[1]}
-

${content.replace(/<\/?[^>]+(>|$)/g, "").slice(0, 250)}...

-
-
-
` - list.insertAdjacentHTML('beforeend', html); - } -})(); \ No newline at end of file diff --git a/themes/openaq/layouts/about/blog/list.html b/themes/openaq/layouts/about/blog/list.html deleted file mode 100644 index 427a00ec..00000000 --- a/themes/openaq/layouts/about/blog/list.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ define "main" }} -{{ partial "breadcrumbs" . }} -
- - {{ partial "bubbles" }} - - -
-
-

{{ .Title }}

- -
-
-
-{{ partial "community-banner" . }} -{{ partial "explore-banner" . }} -{{ end }} - - -{{ define "scripts" }} -{{ $js := resources.Get "js/blog.js" | js.Build | resources.Minify }} -{{ $secureJS := $js | resources.Fingerprint "sha512" }} - - -{{ end }} \ No newline at end of file diff --git a/themes/openaq/layouts/partials/header.html b/themes/openaq/layouts/partials/header.html index 8d4af444..b42298da 100644 --- a/themes/openaq/layouts/partials/header.html +++ b/themes/openaq/layouts/partials/header.html @@ -38,7 +38,7 @@ - +