Merge pull request #177 from ladunjexa/patch-3
🎨 [enhancement] Add code to display tags & categories in the main blog page
This commit is contained in:
@ -5,8 +5,10 @@ import Layout from '~/layouts/PageLayout.astro';
|
|||||||
import BlogList from '~/components/blog/List.astro';
|
import BlogList from '~/components/blog/List.astro';
|
||||||
import Headline from '~/components/blog/Headline.astro';
|
import Headline from '~/components/blog/Headline.astro';
|
||||||
import Pagination from '~/components/blog/Pagination.astro';
|
import Pagination from '~/components/blog/Pagination.astro';
|
||||||
|
// import PostTags from "~/components/blog/Tags.astro";
|
||||||
|
|
||||||
import { fetchPosts } from '~/utils/blog';
|
import { fetchPosts } from '~/utils/blog';
|
||||||
|
// import { findTags, findCategories } from '~/utils/blog';
|
||||||
import { BLOG_BASE } from '~/utils/permalinks';
|
import { BLOG_BASE } from '~/utils/permalinks';
|
||||||
|
|
||||||
export async function getStaticPaths({ paginate }) {
|
export async function getStaticPaths({ paginate }) {
|
||||||
@ -20,6 +22,9 @@ export async function getStaticPaths({ paginate }) {
|
|||||||
const { page } = Astro.props;
|
const { page } = Astro.props;
|
||||||
const currentPage = page.currentPage ?? 1;
|
const currentPage = page.currentPage ?? 1;
|
||||||
|
|
||||||
|
// const allCategories = await findCategories();
|
||||||
|
// const allTags = await findTags();
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
title: `Blog${currentPage > 1 ? ` — Page ${currentPage}` : ''}`,
|
title: `Blog${currentPage > 1 ? ` — Page ${currentPage}` : ''}`,
|
||||||
description: SITE.description,
|
description: SITE.description,
|
||||||
@ -37,5 +42,9 @@ const meta = {
|
|||||||
</Headline>
|
</Headline>
|
||||||
<BlogList posts={page.data} />
|
<BlogList posts={page.data} />
|
||||||
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
<Pagination prevUrl={page.url.prev} nextUrl={page.url.next} />
|
||||||
|
<!--
|
||||||
|
<PostTags tags={allCategories} class="mb-2" header="Search by Categories:" isCategory />
|
||||||
|
<PostTags tags={allTags} header="Search by Tags:" />
|
||||||
|
-->
|
||||||
</section>
|
</section>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
Reference in New Issue
Block a user