Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSS feed fixes #28

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 105 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"klona": "^2.0.6",
"luxon": "^3.5.0",
"reflect-metadata": "^0.2.2",
"sanitize-html": "^2.13.1",
"sqlite3": "^5.1.7",
"unist-util-map": "^4.0.0"
},
Expand Down
12 changes: 6 additions & 6 deletions resources/views/feeds/blog.edge
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<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>AdonisJS Framework Blog</title>
<link>https://adonisjs.com/</link>
<link>https://adonisjs.com/blog</link>
<description>All the latest AdonisJS Framework news.</description>
<lastBuildDate>{{new Date()}}</lastBuildDate>
<lastBuildDate>{{new Date().toUTCString()}}</lastBuildDate>
<docs>https://validator.w3.org/feed/docs/rss2.html</docs>
<language>en</language>
<image>
Expand All @@ -16,11 +16,11 @@
@each(post in blogPosts)
<item>
<title><![CDATA[{{ post.title }}]]></title>
<link>{{ route('blog.show', [post.slug]) }}</link>
<guid>{{ post.slug }}</guid>
<link>https://adonisjs.com{{ route('blog.show', [post.slug]) }}</link>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the best way to get an absolute URL containing the right domain?

<guid>https://adonisjs.com{{ route('blog.show', [post.slug]) }}</guid>
<pubDate>{{ post.publishedAt }}</pubDate>
<description><![CDATA[ {{{ post.contentHtml.summary }}} ]]></description>
<content:encoded><![CDATA[ {{{ post.contentHtml.contents }}} ]]></content:encoded>
<description><![CDATA[ {{{ sanitize(post.contentHtml.summary) }}} ]]></description>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanitization is necessary so that we don't include dangerous elements in the output, such as script tags, etc. This solves almost all of the content related warnings in the validation tool.

<content:encoded><![CDATA[ {{{ sanitize(post.contentHtml.contents) }}} ]]></content:encoded>
</item>
@end
</channel>
Expand Down
2 changes: 2 additions & 0 deletions start/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import edgeUiKit from 'edge-uikit'
import { icons as uiwIcons } from '@iconify-json/uiw'
import { edgeIconify, addCollection } from 'edge-iconify'
import { icons as tablerIcons } from '@iconify-json/tabler'
import sanitizeHtml from 'sanitize-html'

/**
* Icons in use
Expand All @@ -17,3 +18,4 @@ addCollection(tablerIcons)
edge.use(edgeUiKit)
edge.use(edgeIconify)
edge.global('dayjs', dayjs)
edge.global('sanitize', sanitizeHtml)