Skip to content

Commit d1f538f

Browse files
committed
docs: add screenshot and demo page for README
1 parent af6cc7c commit d1f538f

File tree

4 files changed

+109
-1
lines changed

4 files changed

+109
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Astro + Notion + Blog
44

5+
![Screenshot](docs/screenshot.webp)
6+
57
## What is different from [astro-notion-blog](https://github.com/otoyo/astro-notion-blog)?
68

79
- Stylish theme inspired by [Creek](https://github.com/robertguss/Astro-Theme-Creek)

docs/screenshot.webp

67.9 KB
Loading

src/layouts/Layout.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type Props = {
1616
canonicalUrl?: string;
1717
ogImage?: string;
1818
rssUrl?: string;
19+
database?: { title: string; description: string; cover?: string };
1920
};
2021
2122
const {
@@ -24,9 +25,10 @@ const {
2425
canonicalUrl = "",
2526
ogImage = "",
2627
rssUrl = "",
28+
database: dbProp,
2729
} = Astro.props;
2830
29-
const database = await client.getDatabase();
31+
const database = dbProp ?? await client.getDatabase();
3032
const siteTitle = title
3133
? `${title}${config.head?.titleSeparator || " | "}${database.title}`
3234
: database.title;

src/pages/demo.astro

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
---
2+
import Card from "../components/Card.astro";
3+
import config from "../config";
4+
import Layout from "../layouts/Layout.astro";
5+
6+
if (!import.meta.env.DEV) {
7+
return Astro.redirect("/404");
8+
}
9+
10+
const database = {
11+
title: "Astrotion",
12+
description: "A collection of thoughts, ideas, and discoveries about technology, design, and life.",
13+
};
14+
15+
const posts = [
16+
{
17+
title: "Getting Started with Astro",
18+
excerpt: "Learn how to build blazingly fast websites with Astro, the modern static site generator that ships zero JavaScript by default.",
19+
image: "https://images.unsplash.com/photo-1517694712202-14dd9538aa97?w=800&h=450&fit=crop",
20+
date: "2025-01-15",
21+
slug: "getting-started-with-astro",
22+
},
23+
{
24+
title: "The Art of Minimalist Design",
25+
excerpt: "Exploring the principles of minimalist design and how less can truly be more when creating memorable user experiences.",
26+
image: "https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?w=800&h=450&fit=crop",
27+
date: "2025-01-12",
28+
slug: "minimalist-design",
29+
},
30+
{
31+
title: "Building a Second Brain",
32+
excerpt: "A practical guide to organizing your digital life and creating a personal knowledge management system that actually works.",
33+
image: "https://images.unsplash.com/photo-1456324504439-367cee3b3c32?w=800&h=450&fit=crop",
34+
date: "2025-01-10",
35+
slug: "second-brain",
36+
},
37+
{
38+
title: "Remote Work Best Practices",
39+
excerpt: "Tips and strategies for staying productive and maintaining work-life balance while working from anywhere in the world.",
40+
image: "https://images.unsplash.com/photo-1522202176988-66273c2fd55f?w=800&h=450&fit=crop",
41+
date: "2025-01-08",
42+
slug: "remote-work",
43+
},
44+
{
45+
title: "Introduction to TypeScript",
46+
excerpt: "Why TypeScript is becoming the go-to choice for JavaScript developers and how to get started with type-safe coding.",
47+
image: "https://images.unsplash.com/photo-1555066931-4365d14bab8c?w=800&h=450&fit=crop",
48+
date: "2025-01-05",
49+
slug: "intro-typescript",
50+
},
51+
{
52+
title: "Mastering CSS Grid Layout",
53+
excerpt: "A comprehensive guide to CSS Grid, the powerful layout system that makes complex web layouts simple and intuitive.",
54+
image: "https://images.unsplash.com/photo-1507721999472-8ed4421c4af2?w=800&h=450&fit=crop",
55+
date: "2025-01-03",
56+
slug: "css-grid",
57+
},
58+
];
59+
60+
const formatDate = (dateStr: string) => {
61+
return new Date(dateStr).toLocaleDateString("en-US", {
62+
year: "numeric",
63+
month: "long",
64+
day: "numeric",
65+
});
66+
};
67+
---
68+
69+
<Layout database={database}>
70+
<main class="py-12 lg:py-20">
71+
<article class="max-w-6xl mx-auto px-3">
72+
<header class="text-center mb-12">
73+
<h1 class:list={["mb-12 text-6xl title", config.index?.titleClasses]}>
74+
{database.title}
75+
</h1>
76+
<p class="mx-auto max-w-xl">
77+
{database.description}
78+
</p>
79+
</header>
80+
<section class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 py-8">
81+
{
82+
posts.map((post) => (
83+
<Card
84+
href={`/posts/${post.slug}`}
85+
title={post.title}
86+
body={post.excerpt}
87+
image={post.image}
88+
date={formatDate(post.date)}
89+
/>
90+
))
91+
}
92+
</section>
93+
</article>
94+
</main>
95+
</Layout>
96+
<style
97+
define:vars={{
98+
titleFontFamily: config.index?.titleFontFamily || "inherit",
99+
}}
100+
>
101+
.title {
102+
font-family: var(--titleFontFamily);
103+
}
104+
</style>

0 commit comments

Comments
 (0)