base setup
This commit is contained in:
commit
688d794dc7
30 changed files with 4362 additions and 0 deletions
23
src/pages/articles/index.astro
Normal file
23
src/pages/articles/index.astro
Normal file
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
import "../../styles/style.css";
|
||||
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
import ContentPost from "../../components/ContentPost.astro";
|
||||
|
||||
const allPosts = await Astro.glob("./*.mdx");
|
||||
|
||||
const pageTitle = "Articles";
|
||||
const titleColor = "hotpink";
|
||||
---
|
||||
|
||||
<BaseLayout pageTitle={pageTitle} titleColor={titleColor}>
|
||||
<ul>
|
||||
{
|
||||
allPosts.map((post) => (
|
||||
<li>
|
||||
<ContentPost url={post.url} title={post.frontmatter.title} />
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</BaseLayout>
|
34
src/pages/articles/post-0.mdx
Normal file
34
src/pages/articles/post-0.mdx
Normal file
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
title: "My First Blog Post"
|
||||
pubDate: 2022-07-01
|
||||
description: "This is the first post of my new Astro blog."
|
||||
author: "Astro Learner"
|
||||
tags: ["astro", "blogging", "learning in public"]
|
||||
---
|
||||
|
||||
import MarkdownPostLayout from "../../layouts/MarkdownPostLayout.astro";
|
||||
|
||||
export const published = new Date("2022-07-01");
|
||||
export const image = {
|
||||
url: "/oui.jpg",
|
||||
alt: "oui oui oui",
|
||||
width: "394",
|
||||
height: "512",
|
||||
};
|
||||
|
||||
<MarkdownPostLayout pageTitle={frontmatter.title} published={published} image={image}>
|
||||
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.
|
||||
|
||||
</MarkdownPostLayout>
|
15
src/pages/articles/post-1.mdx
Normal file
15
src/pages/articles/post-1.mdx
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
layout: ../../layouts/MarkdownPostLayout.astro
|
||||
title: My Second Blog Post
|
||||
author: Astro Learner
|
||||
description: "After learning some Astro, I couldn't stop!"
|
||||
image:
|
||||
url: "/hackerman.png"
|
||||
alt: "hack"
|
||||
width: 1920
|
||||
height: 1080
|
||||
pubDate: 2022-07-08
|
||||
tags: ["astro", "blogging", "learning in public", "successes"]
|
||||
---
|
||||
|
||||
After a successful first week learning Astro, I decided to try some more. I wrote and imported a small component from memory!
|
15
src/pages/articles/post-2.mdx
Normal file
15
src/pages/articles/post-2.mdx
Normal file
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
layout: ../../layouts/MarkdownPostLayout.astro
|
||||
title: Special tag
|
||||
author: Astro Learner
|
||||
pubDate: 2022-07-08
|
||||
tags: ["nicool"]
|
||||
---
|
||||
|
||||
That's it bb
|
||||
|
||||
```html
|
||||
<main>
|
||||
<header></header>
|
||||
</main>
|
||||
```
|
9
src/pages/index.astro
Normal file
9
src/pages/index.astro
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
import BaseLayout from '../layouts/BaseLayout.astro';
|
||||
|
||||
const pageTitle = "Accueil"
|
||||
---
|
||||
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<h2>devvvvv</h2>
|
||||
</BaseLayout>
|
9
src/pages/rss.xml.js
Normal file
9
src/pages/rss.xml.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
import rss from '@astrojs/rss';
|
||||
|
||||
export const get = () => rss({
|
||||
title: 'Nicolas Arduin | Articles',
|
||||
description: 'Je blog un peu',
|
||||
site: 'https://www.nardu.in',
|
||||
items: import.meta.glob('./**/*.md'),
|
||||
customData: `<language>fr-fr</language>`,
|
||||
});
|
37
src/pages/tags/[tag].astro
Normal file
37
src/pages/tags/[tag].astro
Normal file
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
import ContentPost from "../../components/ContentPost.astro";
|
||||
|
||||
export async function getStaticPaths({}) {
|
||||
const allPosts = await Astro.glob("../articles/*.mdx");
|
||||
const uniqueTags = [
|
||||
...new Set(allPosts.map((post) => post.frontmatter.tags).flat()),
|
||||
];
|
||||
|
||||
return uniqueTags.map((tag) => {
|
||||
const filteredPosts = allPosts.filter((post) =>
|
||||
post.frontmatter.tags.includes(tag)
|
||||
);
|
||||
return {
|
||||
params: { tag },
|
||||
props: { posts: filteredPosts },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { tag } = Astro.params;
|
||||
const { posts } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout pageTitle={tag}>
|
||||
<p>Posts tagged with {tag}</p>
|
||||
<ul>
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<ContentPost url={post.url} title={post.frontmatter.title} />
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</BaseLayout>
|
20
src/pages/tags/index.astro
Normal file
20
src/pages/tags/index.astro
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
import BaseLayout from "../../layouts/BaseLayout.astro";
|
||||
|
||||
const pageTitle = "Tag Index";
|
||||
const allPosts = await Astro.glob("../articles/*.mdx");
|
||||
const tags = [...new Set(allPosts.map((post) => post.frontmatter.tags).flat())];
|
||||
---
|
||||
|
||||
<BaseLayout pageTitle={pageTitle}>
|
||||
<h2>All the categories</h2>
|
||||
<ul>
|
||||
{
|
||||
tags.map((tag) => (
|
||||
<li>
|
||||
<a href={`/tags/${tag}`}>{tag}</a>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
</ul>
|
||||
</BaseLayout>
|
Loading…
Add table
Add a link
Reference in a new issue