mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 19:51:07 +02:00
refactor: optimize multilingual article routing logic, modify slug to abbrlink
This commit is contained in:
parent
16491dae50
commit
e5165dd740
16 changed files with 673 additions and 133 deletions
|
@ -2,22 +2,22 @@
|
|||
// Define props received by the component
|
||||
interface Post {
|
||||
data: {
|
||||
title: string;
|
||||
slug?: string;
|
||||
published: Date;
|
||||
};
|
||||
slug?: string;
|
||||
title: string
|
||||
abbrlink?: string
|
||||
published: Date
|
||||
}
|
||||
slug?: string
|
||||
remarkPluginFrontmatter?: {
|
||||
minutes?: number;
|
||||
};
|
||||
minutes?: number
|
||||
}
|
||||
}
|
||||
|
||||
// Receive posts parameter passed from outside
|
||||
const { posts } = Astro.props;
|
||||
const { posts } = Astro.props
|
||||
|
||||
// Declare the type of props
|
||||
export interface Props {
|
||||
posts: Post[];
|
||||
posts: Post[]
|
||||
}
|
||||
---
|
||||
<ul>
|
||||
|
@ -27,8 +27,8 @@ export interface Props {
|
|||
|
||||
<a
|
||||
class="hover:c-primary"
|
||||
href={`/posts/${post.data.slug || post.slug}`}
|
||||
transition:name={`post-${post.data.slug || post.slug}`}
|
||||
href={`/posts/${post.data.abbrlink || post.slug}/`}
|
||||
transition:name={`post-${post.data.abbrlink || post.slug}`}
|
||||
data-disable-transition-on-theme
|
||||
>
|
||||
{post.data.title}
|
||||
|
@ -36,7 +36,7 @@ export interface Props {
|
|||
|
||||
<div
|
||||
class="uno-mobile-time"
|
||||
transition:name={`time-${post.data.slug || post.slug}`}
|
||||
transition:name={`time-${post.data.abbrlink || post.slug}`}
|
||||
data-disable-transition-on-theme
|
||||
>
|
||||
<time>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue