Skip to content

Commit

Permalink
change up rss builder to get rid of lightbox images
Browse files Browse the repository at this point in the history
  • Loading branch information
uuupah committed Mar 1, 2024
1 parent b67107b commit e082839
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ module.exports = function (eleventyConfig) {
);

//TODO - use this to replace iframes in rss
eleventyConfig.addFilter("unIframe", function (content) {
eleventyConfig.addFilter("rssCleanup", function (content) {
const dom = new JSDOM(content);
const doc = dom.window.document;

// reconfigure iframes
for (iframe of doc.getElementsByTagName("iframe")) {
console.log(iframe.getAttribute("src"));

Expand All @@ -206,6 +207,9 @@ module.exports = function (eleventyConfig) {
iframe.appendChild(doc.createElement("br"));
}

// remove lightbox images from rss because the rss cant hide them properly
doc.querySelectorAll('.lightbox').forEach (e => e.remove());

var out = dom.serialize();

console.log(out);
Expand Down
2 changes: 1 addition & 1 deletion src/feed.njk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | dateToRfc3339 }}</updated>
<id>{{ absolutePostUrl }}</id>
<content xml:lang="{{ metadata.language }}" type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | unIframe }}</content>
<content xml:lang="{{ metadata.language }}" type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) | rssCleanup }}</content>
</entry>
{%- endif %}
{%- endfor %}
Expand Down

0 comments on commit e082839

Please sign in to comment.