feat: add blog pages

This commit is contained in:
log101 2024-05-12 08:55:29 +03:00
parent 45a5337447
commit a67ade9672
5 changed files with 49 additions and 8 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ pnpm-debug.log*
# jetbrains setting folder
.idea/
TODO
.env.development

View File

@ -1,5 +1,7 @@
---
console.log(import.meta.env.DEV);
const host = import.meta.env.HOST_NAME;
---
<style>
@ -62,6 +64,11 @@
height: 110px;
}
.title-and-gol a {
text-decoration: none;
color: inherit;
}
.main-title {
font-family: "Courier New", Courier, monospace;
font-size: var(--h1-desktop);
@ -82,7 +89,7 @@
<div class="title-and-nav">
<div class="title-and-gol">
<h1 class="main-title">log101</h1>
<a href={host}><h1 class="main-title">log101</h1></a>
<div id="board" class="board"></div>
</div>
<div>

View File

@ -77,10 +77,17 @@ switch (componentType) {
<div class="post">
<p class="post-category">{post.data.subcategory}</p>
<h4 class="post-title">{post.data.title}</h4>
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
<div class="tags-and-date">
{
showTags && (
<ul class="post-tags">
{post.data.tags.map((tag) => <li>{tag}</li>)}
{post.data.tags.map((tag) => (
<li>{tag}</li>
))}
</ul>
)
}
<p class="post-date">
{
@ -93,7 +100,6 @@ switch (componentType) {
</p>
</div>
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
{longSummary && <p class="post-long-summary">{post.body.slice(0, 500)}</p>}
{fullText && <p class="post-text">{post.body}</p>}
</div>

View File

@ -0,0 +1,27 @@
---
import { getCollection } from "astro:content";
import Footer from "@/components/Footer.astro";
import Header from "@/components/Header.astro";
import Layout from "@/layouts/Layout.astro";
import "@/styles/home.css";
export async function getStaticPaths() {
const blogEntries = await getCollection("blog");
return blogEntries.map((entry) => ({
params: { category: entry.data.category, slug: entry.slug },
props: { entry },
}));
}
const { entry } = Astro.props;
---
<Layout title="log101">
<di class="container">
<Header />
{entry.body}
<a class="home-all-posts" href="#">Tüm Yayınlar</a>
<Footer />
</di>
</Layout>

View File

@ -1,6 +1,6 @@
---
import { getCollection } from "astro:content";
import { CATEGORIES } from "../../content/config";
import { CATEGORIES } from "@/content/config";
import Header from "@/components/Header.astro";
import Footer from "@/components/Footer.astro";
@ -10,9 +10,9 @@ import Post from "@/components/Post.astro";
import "@/styles/home.css";
export function getStaticPaths() {
return CATEGORIES.map((c) => {
return CATEGORIES.map((category) => {
return {
params: { category: c },
params: { category },
};
});
}