Skip to content

Commit 9f495bd

Browse files
committed
fix(changelog): posts pathname to / route instead of /versions
1 parent 0fc776e commit 9f495bd

5 files changed

Lines changed: 4 additions & 64 deletions

File tree

changelog/astro.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @ts-check
22
import { defineConfig } from 'astro/config';
3-
import { urlToVidTag, rehypeFirstH1Link } from './src/utils';
3+
import { urlToVidTag } from './src/utils';
44
import tailwindcss from '@tailwindcss/vite';
55

66
export default defineConfig({
@@ -9,7 +9,6 @@ export default defineConfig({
99

1010
markdown: {
1111
remarkPlugins: [urlToVidTag],
12-
rehypePlugins: [rehypeFirstH1Link],
1312
},
1413

1514
vite: {

changelog/src/components/PostList.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const formatDate = (date: Date) => {
1919
{posts.map((post) => (
2020
<li class="grid grid-cols-[150px_1fr] gap-10">
2121
<div class="flex flex-col items-start">
22-
<a href={`${baseurl}/version/${post.id}`} class="sticky top-25 w-full">
22+
<a href={`${baseurl}/${post.id}`} class="sticky top-25 w-full">
2323
<span class="text-sm text-surface-gray-5 flex items-center gap-3">
2424
<div
2525
class="bg-surface-gray-5 size-2 rounded shrink-0 relative z-10 ring-4 ring-outline-gray-2"
@@ -33,7 +33,7 @@ const formatDate = (date: Date) => {
3333
<div class="mb-15 -mt-1 flex flex-col">
3434
<a
3535
class="w-fit text-2xl font-semibold relative pb-1 after:absolute after:bottom-0 after:left-0 after:h-[1px] after:w-0 after:bg-current after:transition-all after:duration-300 hover:after:w-full"
36-
href={`${baseurl}/version/${post.id}`}
36+
href={`${baseurl}/${post.id}`}
3737
>
3838
{post.data.title}
3939
</a>

changelog/src/pages/page/[page].astro

Lines changed: 0 additions & 31 deletions
This file was deleted.

changelog/src/utils.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { visit, EXIT } from 'unist-util-visit';
1+
import { visit } from 'unist-util-visit';
22

33
export const urlToVidTag = () => (tree) => {
44
visit(tree, 'paragraph', (node, index, parent) => {
@@ -19,34 +19,6 @@ export const urlToVidTag = () => (tree) => {
1919
});
2020
};
2121

22-
export const rehypeFirstH1Link = () => {
23-
return (tree, file) => {
24-
const id = file.history[0]
25-
?.split('/')
26-
.pop()
27-
?.replace(/\.mdx?$/, '');
28-
29-
if (!id) return;
30-
31-
visit(tree, 'element', (node) => {
32-
if (node.tagName === 'h2') {
33-
node.children = [
34-
{
35-
type: 'element',
36-
tagName: 'a',
37-
properties: {
38-
href: `/releases/version/${id}`,
39-
class: 'no-underline font-semibold',
40-
},
41-
children: node.children,
42-
},
43-
];
44-
return EXIT;
45-
}
46-
});
47-
};
48-
};
49-
5022
export const getFileFromRoute = (str: string) => {
5123
const filename = str?.split('/')?.pop()?.replace('.md', '');
5224
return filename?.replace('_', '.');

0 commit comments

Comments
 (0)