feat: add blog pages
This commit is contained in:
parent
45a5337447
commit
a67ade9672
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -22,3 +22,4 @@ pnpm-debug.log*
|
||||||
# jetbrains setting folder
|
# jetbrains setting folder
|
||||||
.idea/
|
.idea/
|
||||||
TODO
|
TODO
|
||||||
|
.env.development
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
---
|
---
|
||||||
|
console.log(import.meta.env.DEV);
|
||||||
|
|
||||||
|
const host = import.meta.env.HOST_NAME;
|
||||||
---
|
---
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -62,6 +64,11 @@
|
||||||
height: 110px;
|
height: 110px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title-and-gol a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
.main-title {
|
.main-title {
|
||||||
font-family: "Courier New", Courier, monospace;
|
font-family: "Courier New", Courier, monospace;
|
||||||
font-size: var(--h1-desktop);
|
font-size: var(--h1-desktop);
|
||||||
|
@ -82,7 +89,7 @@
|
||||||
|
|
||||||
<div class="title-and-nav">
|
<div class="title-and-nav">
|
||||||
<div class="title-and-gol">
|
<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 id="board" class="board"></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -77,10 +77,17 @@ switch (componentType) {
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<p class="post-category">{post.data.subcategory}</p>
|
<p class="post-category">{post.data.subcategory}</p>
|
||||||
<h4 class="post-title">{post.data.title}</h4>
|
<h4 class="post-title">{post.data.title}</h4>
|
||||||
|
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
|
||||||
<div class="tags-and-date">
|
<div class="tags-and-date">
|
||||||
<ul class="post-tags">
|
{
|
||||||
{post.data.tags.map((tag) => <li>{tag}</li>)}
|
showTags && (
|
||||||
</ul>
|
<ul class="post-tags">
|
||||||
|
{post.data.tags.map((tag) => (
|
||||||
|
<li>{tag}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
<p class="post-date">
|
<p class="post-date">
|
||||||
{
|
{
|
||||||
|
@ -93,7 +100,6 @@ switch (componentType) {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{shortSummary && <p class="post-summary">{post.data.summary}</p>}
|
|
||||||
{longSummary && <p class="post-long-summary">{post.body.slice(0, 500)}</p>}
|
{longSummary && <p class="post-long-summary">{post.body.slice(0, 500)}</p>}
|
||||||
{fullText && <p class="post-text">{post.body}</p>}
|
{fullText && <p class="post-text">{post.body}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
27
src/pages/category/[category]/[slug]/index.astro
Normal file
27
src/pages/category/[category]/[slug]/index.astro
Normal 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>
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
import { getCollection } from "astro:content";
|
import { getCollection } from "astro:content";
|
||||||
import { CATEGORIES } from "../../content/config";
|
import { CATEGORIES } from "@/content/config";
|
||||||
|
|
||||||
import Header from "@/components/Header.astro";
|
import Header from "@/components/Header.astro";
|
||||||
import Footer from "@/components/Footer.astro";
|
import Footer from "@/components/Footer.astro";
|
||||||
|
@ -10,9 +10,9 @@ import Post from "@/components/Post.astro";
|
||||||
import "@/styles/home.css";
|
import "@/styles/home.css";
|
||||||
|
|
||||||
export function getStaticPaths() {
|
export function getStaticPaths() {
|
||||||
return CATEGORIES.map((c) => {
|
return CATEGORIES.map((category) => {
|
||||||
return {
|
return {
|
||||||
params: { category: c },
|
params: { category },
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user