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

Upgrade to Astro 5 and convert to new Content Layer API #105

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

huijing
Copy link
Contributor

@huijing huijing commented Dec 16, 2024

This PR upgrades to Astro 5, which requires that we convert to the new Content Layer API (see https://docs.astro.build/en/guides/upgrade-to/v5/). This requires a number of changes to how our blog posts and blog landing page are structured. Detailed comments are made on individual lines in the files tab.

@@ -2,6 +2,8 @@ import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightLinksValidator from "starlight-links-validator";

import mdx from "@astrojs/mdx";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had issues rendering the blog posts written in MDX until this was installed.
See https://docs.astro.build/en/guides/upgrade-to/v5/#astrojsmdx

---
<hr>

<p>As we are open source, you can easily check our work on <a href="https://github.com/interledger/">GitHub</a>. If the work mentioned here inspired you, we welcome your contributions. You can join our <a href="https://communityinviter.com/apps/interledger/interledger-working-groups-slack">community slack</a> or participate in the next <a href="https://docs.google.com/document/u/1/d/1T_Q_eRZtL8GluJR9rVADd7fvkB8mPluMk-d96LM4vlg/edit#heading=h.ybdhwl6k5886">community call</a>, which takes place each second Wednesday of the month.</p>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I remember seeing in either the Slack conversation or blog review discussions that we wanted this at the footer of every blog post, so this component is now part of the blog layout.

@@ -0,0 +1,60 @@
---
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you look closely at the [...page].astro file, you will notice that the pagination API was implemented but the pagination component was never built. This is because I created this blog when there were only 3 blog posts and couldn't be fussed to create the pagination component at the time.
I blinked and now we have 13 blog posts, so here is the pagination component.
Ta-da!

@@ -0,0 +1,24 @@
import { z, defineCollection } from "astro:content";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of the conversion to the new Content Layer API, see https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections

title: "Simplifying Interledger: The Graveyard of Possible Protocol Features"
description: As the development of the Interledger Protocol (ILP) nears completion, I thought we should take a moment to remember some of the many core protocol features we’ve killed off along the way.
date: 2018-01-29
slug: simplifying-interledger-the-graveyard-of-possible-protocol-features
authors: [Evan Schwartz]
author_urls: [https://www.linkedin.com/in/evanmarkschwartz/]
authors:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Realised that we were doing tags in one format, and authors in another format, so I just standardised all YAML sequences (AKA arrays) to the same format.

@@ -209,4 +209,8 @@ article :global(code) {
padding: 0.125rem 0.375rem;
overflow-wrap: anywhere;
}

article :global(ul li) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes the lists with a lot of text look a bit nicer and easier to read

@@ -0,0 +1,21 @@
---
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of the conversion to the new Content Layer API, see https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections

@@ -2,15 +2,16 @@
import type { Page } from "astro";
import { createExcerpt } from '../../utils/create-excerpt';
import BaseLayout from '../../layouts/BaseLayout.astro';
import Pagination from '../../components/blog/Pagination.astro';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Part of the conversion to the new Content Layer API, see https://docs.astro.build/en/guides/upgrade-to/v5/#updating-existing-collections and also implementation of the Pagination component

@@ -1,11 +1,12 @@
---
layout: ../../layouts/BlogLayout.astro
Copy link
Contributor Author

Choose a reason for hiding this comment

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

layout field is no longer supported in Markdown collection entries, see https://docs.astro.build/en/guides/upgrade-to/v5/#breaking-changes-to-legacy-content-and-data-collections

@huijing huijing merged commit ecf6197 into main Dec 16, 2024
1 check passed
@huijing huijing deleted the chj/bump-dependencies branch December 16, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant