diff --git a/src/blog/post-2.md b/src/blog/post-2.md new file mode 100644 index 0000000..4a7cd33 --- /dev/null +++ b/src/blog/post-2.md @@ -0,0 +1,26 @@ +--- +title: 'My Second Blog Post' +pubDate: 2022-07-01 +description: 'This is the first post of my new Astro blog.' +author: 'Astro Learner' +image: + url: 'https://docs.astro.build/assets/rose.webp' + alt: 'The Astro logo on a dark background with a pink glow.' +tags: ["astro", "blogging", "learning in public", "Hello"] +--- + +Published on: 2022-07-01 + +Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website. + +## What I've accomplished + +1. **Installing Astro**: First, I created a new Astro project and set up my online accounts. + +2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder. + +3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts! + +## What's next + +I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come. \ No newline at end of file diff --git a/src/components/Posts/PostItem.astro b/src/components/Posts/PostItem.astro index 9e3c151..beedbdb 100644 --- a/src/components/Posts/PostItem.astro +++ b/src/components/Posts/PostItem.astro @@ -1,23 +1,83 @@ --- -const data=Astro.props +const data = Astro.props; --- -
  • - - {data.title} - {data.date} - + +
  • + +
    + {data.title} + +
    + + {data.title} +
  • +
    + \ No newline at end of file + + .post-image { + width: 120px; + height: calc(120px * 9 / 16); + } + } + diff --git a/src/components/Posts/PostList.astro b/src/components/Posts/PostList.astro index 95da919..d29d06d 100644 --- a/src/components/Posts/PostList.astro +++ b/src/components/Posts/PostList.astro @@ -20,8 +20,16 @@ const allPosts = await getCollection("blog"); url={`/${lang}/posts/${post.id}/`} title={post.data.title} date={formattedDate} + img={post.data.image.url} /> ); }) } + + diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index 8867d7f..c776c06 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -1,6 +1,6 @@ export default { banner: { - title: "Cloverta 的博客", + title: "Cloverta的博客", subtitle: "" }, nav: { diff --git a/src/pages/[lang]/index.astro b/src/pages/[lang]/index.astro index 9153cb8..e78f444 100644 --- a/src/pages/[lang]/index.astro +++ b/src/pages/[lang]/index.astro @@ -10,13 +10,30 @@ export function getStaticPaths() { const lang = getLangFromUrl(Astro.url); const t = getTranslations(lang); +const headerTitle = lang === "zh" ? "Cloverta的博客" : "Cloverta's blog"; const pageTitle = t.home.title; --- - +

    {pageTitle}

    {t.home.content.map((line: string) =>

    )}

    + +
    +
    + +