-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
feat(website): Move blog to CC and fix RSS #937
Conversation
import type { LocaleData } from "@astrojs/starlight/utils/slugs"; | ||
import Page from "@astrojs/starlight/components/Page.astro"; | ||
|
||
export interface Props { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Yan-Thomas I think we could use this layout for Playground page too
Maybe we just need to hide the page title, do you think it's possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I thought when I saw the website rework issue, should be straightforward in theory.
I'd say to keep this layout like so and then tackle a refactor in the Playground PR so we abstract it properly, as there might be a few edge cases to consider and as I also am not familiarized with the current Playground implementation.
@Yan-Thomas Let's change the base branch to |
Any particular reason @victor-teles? I thought this branch was for the rebranding, and considering this PR mostly fixes/improves what we already had I think we can merge it into |
Yeah there's no need. We can merge this PR in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work @Yan-Thomas, thank you! ❤️
import { defineCollection } from "astro:content"; | ||
import { defineCollection, z } from "astro:content"; | ||
|
||
const blogSchema = z.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love content collections!
Co-authored-by: Emanuele Stoppa <[email protected]>
Summary
The current blog was using the old recommended method for querying content (
Astro.glob()
) which had several disadvantages in comparison to the current approach, named Content Collections.This PR moves the entire blog set up to the recommended approach, refactors the internal blog components used, and as a bonus, fixes the generated RSS which was empty before.
There are some considerable changes for the team to be aware of:
Content should now be written in
src/content/blog
instead ofsrc/content/docs/blog
.All blog posts now have a different set of frontmatter properties. I went for a very similar structure, but a few properties weren't necessary anymore or could be improved, for example:
Before:
After:
Authors are now
.json
files insidesrc/content/authors
.To create a new author, create a new
(author).json
file following the format:And to reference it inside a blog post (the author reference id will be its file name without the extension):
Note that authors are shown in a blog post in the order specified in the frontmatter, meaning you can decide who's the main author according to the blog post.
Test Plan
By visually inspecting the deploy preview you can see how all blog posts are as expected.
For the RSS fix, this is the snippet of current RSS feed and the one built by this PR:
Before:
After: