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

Add html to RSS guide #2545

Closed
wants to merge 4 commits into from
Closed

Add html to RSS guide #2545

wants to merge 4 commits into from

Conversation

bholmesdev
Copy link
Contributor

@bholmesdev bholmesdev commented Feb 2, 2023

What kind of changes does this PR include?

  • New or updated content

Description

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 1edb957
🔍 Latest deploy log https://app.netlify.com/sites/astro-docs-2/deploys/63dbc9f912fab10008788447
😎 Deploy Preview https://deploy-preview-2545--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

I've left a couple of larger issue questions to consider here so I can move forward with this, @bholmesdev!

I am also giving you permission to "tag out" at any time if you're uninterested in solving these issues and want to tell Team Docs to figure it out. 😅

@@ -141,35 +141,41 @@ items: import.meta.glob('./blog/*.{md,mdx}'),

The `content` key contains the full content of the post as HTML. This allows you to make your entire post content available to RSS feed readers.

:::caution
Copy link
Member

Choose a reason for hiding this comment

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

Gonna call a flag on the play for caution here! It's not a good look to basically have Section Title then immediately CAUTION as if the thing itself is risky. If it's only our examples/explanation that requires a warning, then we fix that with writing! ;)

There are a couple of different ways we could go about doing this, but let's start by getting your gut reaction: if you were not allowed to use a caution, AND not allowed to put ANY kind of aside (note/tip) upfront like this, how/where would include this piece of information?

These examples focus on rendering Markdown contents. If you are using MDX, you will need to compile MDX contents to HTML manually. We recommend standard Markdown parsers like [Markdown-it](https://github.com/markdown-it/markdown-it) to get started, though this will not resolve JSX expressions or components.
:::

When using content collections, you can render post contents by calling the post's `render()` function and using the `html` property. Note the `html` property **is not present** for MDX entries. If you need to render MDX content, you can compile your MDX manually using the post's `body` property.
Copy link
Member

Choose a reason for hiding this comment

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

Using content collections isn't required for full-post content right? We had this before? (Since 1.6.14)

This seems like when this page was updated, it was updated to now only show an example with content collections. I think it's important to show both, especially since this our blog tutorial includes creating an RSS feed but not using collections. So while we're here and updating the example, let's find a way to re-incorporate an example that works with globbing files in src/pages/, assuming that still works.

This was the original example for full post content. Will this (or an updated version of this) still work for projects not using collections?

import rss from '@astrojs/rss';
import sanitizeHtml from 'sanitize-html';
// Works with Markdown files only!
const postImportResult = import.meta.glob('../posts/**/*.md', { eager: true }); 
const posts = Object.values(postImportResult);
export const get = () => rss({
  title: 'Buzz’s Blog',
  description: 'A humble Astronaut’s guide to the stars',
  site: import.meta.env.SITE,
  items: posts.map((post) => ({
    link: post.url,
    title: post.frontmatter.title,
    pubDate: post.frontmatter.pubDate,
    content: sanitizeHtml(post.compiledContent()),
  }))
});

@sarah11918 sarah11918 added the merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) label Feb 2, 2023
@sarah11918
Copy link
Member

Hi @bholmesdev - I think this idea was scrapped, and so this PR can be closed now. Please reopen if that's not the case! (There were actually two open Docs PRs associated with this, one from you and one from @bluwy , but only that one was closed alongside the Astro PR.)

@sarah11918 sarah11918 closed this Feb 6, 2023
@sarah11918 sarah11918 added the minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah! label Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" when approved by Sarah!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants