-
-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from otoyo/blog-index-to-home
[⚠️ Breaking Changes] Blog index to home
- Loading branch information
Showing
11 changed files
with
68 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,60 @@ | ||
--- | ||
import { NUMBER_OF_POSTS_PER_PAGE } from '../server-constants.ts' | ||
import { | ||
getPosts, | ||
getRankedPosts, | ||
getAllTags, | ||
getNumberOfPages, | ||
} from '../lib/notion/client.ts' | ||
import Layout from '../layouts/Layout.astro' | ||
import NoContents from '../components/NoContents.astro' | ||
import PostDate from '../components/PostDate.astro' | ||
import PostTags from '../components/PostTags.astro' | ||
import PostTitle from '../components/PostTitle.astro' | ||
import PostFeaturedImage from '../components/PostFeaturedImage.astro' | ||
import PostExcerpt from '../components/PostExcerpt.astro' | ||
import ReadMoreLink from '../components/ReadMoreLink.astro' | ||
import Pagination from '../components/Pagination.astro' | ||
import BlogPostsLink from '../components/BlogPostsLink.astro' | ||
import BlogTagsLink from '../components/BlogTagsLink.astro' | ||
import styles from '../styles/blog.module.css' | ||
const [posts, rankedPosts, tags, numberOfPages] = await Promise.all([ | ||
getPosts(NUMBER_OF_POSTS_PER_PAGE), | ||
getRankedPosts(), | ||
getAllTags(), | ||
getNumberOfPages(), | ||
]) | ||
--- | ||
|
||
<Layout> | ||
<div class="container"> | ||
<div className={styles.container}> | ||
<main> | ||
<h2>Welcome!</h2> | ||
<p>Your astro-notion-blog deployed successfully!</p> | ||
<p>Have fun!</p> | ||
{ | ||
posts.length === 0 ? ( | ||
<NoContents contents={posts} /> | ||
) : ( | ||
posts.map((post) => ( | ||
<div className={styles.post} key={post.Slug}> | ||
<PostDate post={post} /> | ||
<PostTags post={post} /> | ||
<PostTitle post={post} /> | ||
<PostFeaturedImage post={post} /> | ||
<PostExcerpt post={post} /> | ||
<ReadMoreLink post={post} /> | ||
</div> | ||
)) | ||
) | ||
} | ||
|
||
<footer> | ||
<Pagination currentPage={1} numberOfPages={numberOfPages} /> | ||
</footer> | ||
</main> | ||
|
||
<aside> | ||
<BlogPostsLink heading="Recommended" posts={rankedPosts} /> | ||
<BlogTagsLink heading="Categories" tags={tags} /> | ||
</aside> | ||
</div> | ||
</Layout> | ||
|
||
<style> | ||
.container { | ||
width: 640px; | ||
max-width: 100%; | ||
margin: 0 auto; | ||
} | ||
|
||
.container > main { | ||
margin-bottom: 40px; | ||
} | ||
.container div:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
.container h2 { | ||
margin: 0 0 14px; | ||
font-size: 1.4rem; | ||
font-weight: 400; | ||
} | ||
|
||
.container p { | ||
margin: 0.3rem auto; | ||
line-height: 2rem; | ||
} | ||
</style> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters