mirror of
https://github.com/10h30/astroplate.git
synced 2026-07-19 22:53:36 +09:00
initialize project
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { markdownify } from "@lib/utils/textConverter";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
const entry = await getEntryBySlug("pages", "404");
|
||||
const { Content } = await entry.render();
|
||||
---
|
||||
|
||||
<Base title={entry.data.title}>
|
||||
<section class="section-sm">
|
||||
<div class="container">
|
||||
<div class="row justify-center">
|
||||
<div class="text-center sm:col-10 md:col-8 lg:col-6">
|
||||
<img class="mb-8 w-full" src="images/404.png" alt="page not found" />
|
||||
<h1 class="h2 mb-4" set:html={markdownify(entry.data.title)} />
|
||||
<Content />
|
||||
<a href="/" class="btn btn-primary mt-8">Back To Home</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
---
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const pages = await getSinglePage("pages");
|
||||
|
||||
const paths = pages.map((page) => ({
|
||||
params: {
|
||||
regular: page.slug,
|
||||
},
|
||||
props: { page },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const { page } = Astro.props;
|
||||
const { title, meta_title, description, image } = page.data;
|
||||
const { Content } = await page.render();
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
description={description}
|
||||
image={image}
|
||||
>
|
||||
<PageHeader title={title} />
|
||||
<section class="section-sm">
|
||||
<div class="container">
|
||||
<div class="row justify-center">
|
||||
<div class="lg:col-10">
|
||||
<div class="content">
|
||||
<Content />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
import { Image } from "@astrojs/image/components";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { markdownify } from "@lib/utils/textConverter";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
|
||||
const entry = await getEntryBySlug("pages", "about");
|
||||
const { Content } = await entry.render();
|
||||
const { title, description, meta_title, image } = entry.data;
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
description={description}
|
||||
image={image}
|
||||
>
|
||||
<section class="section-sm">
|
||||
<div class="container">
|
||||
<div class="row justify-center">
|
||||
<div class="text-center md:col-10 lg:col-7">
|
||||
{
|
||||
image && (
|
||||
<Image
|
||||
class="mx-auto mb-6 rounded-lg"
|
||||
src={image}
|
||||
width={200}
|
||||
height={200}
|
||||
alt={title}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<h2 set:html={markdownify(title)} class="h3 mb-6" />
|
||||
<div class="content">
|
||||
<Content />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
---
|
||||
import { Image } from "@astrojs/image/components";
|
||||
import BlogCard from "@components/BlogCard.astro";
|
||||
import Social from "@components/Social.astro";
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import { slugify } from "@lib/utils/textConverter";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const authors = await getSinglePage("authors");
|
||||
|
||||
const paths = authors.map((author) => ({
|
||||
params: {
|
||||
single: author.slug,
|
||||
},
|
||||
props: { author },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
const { author } = Astro.props;
|
||||
const { title, social, meta_title, description, image } = author.data;
|
||||
const { Content } = await author.render();
|
||||
const posts = await getSinglePage(blog_folder);
|
||||
const postFilterByAuthor = posts.filter(
|
||||
(post) => slugify(post.data.author) === slugify(title)
|
||||
);
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
description={description}
|
||||
image={image}
|
||||
>
|
||||
<section class="section-sm pb-0">
|
||||
<div class="container">
|
||||
<div
|
||||
class="row justify-center border-b border-border pb-14 dark:border-darkmode-border"
|
||||
>
|
||||
<div class="text-center lg:col-4">
|
||||
{
|
||||
image && (
|
||||
<Image
|
||||
src={image}
|
||||
class="mx-auto mb-10 rounded"
|
||||
height={200}
|
||||
width={200}
|
||||
alt={title}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<h1 class="h3 mb-6">{title}</h1>
|
||||
<div class="content">
|
||||
<Content />
|
||||
</div>
|
||||
<Social source={social} className="social-icons" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-center pb-16 pt-14">
|
||||
{
|
||||
postFilterByAuthor.map((post) => (
|
||||
<div class="mb-12 md:col-6 lg:col-4">
|
||||
<BlogCard data={post} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
---
|
||||
import AuthorCard from "@components/AuthorCard.astro";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
|
||||
const authorIndex = await getEntryBySlug<any, string>("authors", "_index");
|
||||
const authors = await getSinglePage("authors");
|
||||
---
|
||||
|
||||
<Base title={authorIndex.data.title}>
|
||||
<PageHeader title={authorIndex.data.title} />
|
||||
<section class="section-sm pb-0">
|
||||
<div class="container">
|
||||
<div class="row justify-center">
|
||||
{
|
||||
authors.map((author) => (
|
||||
<div class="mb-14 md:col-6 lg:col-4">
|
||||
<AuthorCard data={author} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
---
|
||||
import BlogCard from "@components/BlogCard.astro";
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import { getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import taxonomyFilter from "@lib/utils/taxonomyFilter";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const categories = await getTaxonomy(
|
||||
config.settings.blog_folder,
|
||||
"categories"
|
||||
);
|
||||
|
||||
return categories.map((category) => {
|
||||
return {
|
||||
params: { category },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { category } = Astro.params;
|
||||
const posts = await getSinglePage(config.settings.blog_folder);
|
||||
const filterByCategories = taxonomyFilter(posts, "categories", category);
|
||||
---
|
||||
|
||||
<Base title={category}>
|
||||
<PageHeader title={category} />
|
||||
<div class="section-sm pb-0">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{
|
||||
filterByCategories.map((post) => (
|
||||
<div class="mb-14 md:col-6 lg:col-4">
|
||||
<BlogCard data={post} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Base>
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
---
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import { humanize } from "@lib/utils/textConverter";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
const categories = await getTaxonomy(blog_folder, "categories");
|
||||
const allCategories = await getAllTaxonomy(blog_folder, "categories");
|
||||
---
|
||||
|
||||
<Base title={"Categories"}>
|
||||
<PageHeader title={"Categories"} />
|
||||
<section class="section">
|
||||
<div class="container text-center">
|
||||
<ul class="space-x-4">
|
||||
{
|
||||
categories.map((category: any) => {
|
||||
const count = allCategories.filter((c) => c === category).length;
|
||||
return (
|
||||
<li class="inline-block">
|
||||
<a
|
||||
href={`/categories/${category}`}
|
||||
class="rounded bg-theme-light px-4 py-2 text-xl text-dark dark:bg-darkmode-theme-light dark:text-darkmode-dark"
|
||||
>
|
||||
{humanize(category)}{" "}
|
||||
<span class="ml-2 rounded bg-body px-2 dark:bg-darkmode-body">
|
||||
{count}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
|
||||
const entry = await getEntryBySlug("pages", "contact");
|
||||
const { contact_form_action } = config.params;
|
||||
const { title, description, meta_title, image } = entry.data;
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
description={description}
|
||||
image={image}
|
||||
>
|
||||
<PageHeader title={title} />
|
||||
<section class="section-sm">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="mx-auto md:col-10 lg:col-6">
|
||||
<form action={contact_form_action} method="POST">
|
||||
<div class="mb-6">
|
||||
<label for="name" class="form-label">
|
||||
Full Name <span class="text-red-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="name"
|
||||
class="form-input"
|
||||
placeholder="John Doe"
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="mail" class="form-label">
|
||||
Working Mail <span class="text-red-500">*</span>
|
||||
</label>
|
||||
<input
|
||||
id="mail"
|
||||
class="form-input"
|
||||
placeholder="john.doe@email.com"
|
||||
type="email"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-6">
|
||||
<label for="message" class="form-label">
|
||||
Anything else? <span class="text-red-500">*</span>
|
||||
</label>
|
||||
<textarea
|
||||
class="form-input"
|
||||
placeholder="Message goes here..."
|
||||
id="message"
|
||||
rows="8"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+111
@@ -0,0 +1,111 @@
|
||||
---
|
||||
import { Image } from "@astrojs/image/components";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { markdownify } from "@lib/utils/textConverter";
|
||||
import CallToAction from "@partials/CallToAction.astro";
|
||||
import Testimonial from "@partials/Testimonial.astro";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
import { FaCheck } from "react-icons/fa/index.js";
|
||||
|
||||
const homepage = await getEntryBySlug("homepage", "index");
|
||||
const testimonial = await getEntryBySlug("sections", "testimonial");
|
||||
const call_to_action = await getEntryBySlug("sections", "call-to-action");
|
||||
const { banner, features } = homepage.data;
|
||||
---
|
||||
|
||||
<Base>
|
||||
<!-- Banner -->
|
||||
<section class="section pt-14">
|
||||
<div class="container">
|
||||
<div class="row justify-center">
|
||||
<div class="mb-16 text-center lg:col-7">
|
||||
<h1 set:html={markdownify(banner.title)} class="mb-4" />
|
||||
<p set:html={markdownify(banner.content)} class="mb-8" />
|
||||
{
|
||||
banner.button.enable && (
|
||||
<a class="btn btn-primary" href={banner.button.link}>
|
||||
{banner.button.label}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
{
|
||||
banner.image && (
|
||||
<div class="col-12">
|
||||
<img
|
||||
src={banner.image}
|
||||
width="1272"
|
||||
height="403"
|
||||
alt="banner image"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /Banner -->
|
||||
|
||||
<!-- Features -->
|
||||
{
|
||||
features.map(
|
||||
(
|
||||
feature: {
|
||||
button: any;
|
||||
image: string;
|
||||
bulletpoints: any;
|
||||
content: string;
|
||||
title: string;
|
||||
},
|
||||
index: number
|
||||
) => (
|
||||
<section class={`section-sm ${index % 2 === 0 && "bg-gradient"}`}>
|
||||
<div class="container">
|
||||
<div class="row items-center justify-between">
|
||||
<div
|
||||
class={`mb:md-0 mb-6 md:col-5 ${
|
||||
index % 2 !== 0 && "md:order-2"
|
||||
}`}
|
||||
>
|
||||
<Image
|
||||
src={feature.image}
|
||||
height={480}
|
||||
width={520}
|
||||
fit="contain"
|
||||
background="rgba(0,0,0,0)"
|
||||
alt={feature.title}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class={`md:col-7 lg:col-6 ${index % 2 !== 0 && "md:order-1"}`}
|
||||
>
|
||||
<h2 set:html={markdownify(feature.title)} class="mb-4" />
|
||||
<p
|
||||
set:html={markdownify(feature.content)}
|
||||
class="mb-8 text-lg"
|
||||
/>
|
||||
<ul>
|
||||
{feature.bulletpoints.map((bullet: string) => (
|
||||
<li class="relative mb-4 pl-6">
|
||||
<FaCheck className={"absolute left-0 top-1.5"} />
|
||||
{markdownify(bullet)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{feature.button.enable && (
|
||||
<a class="btn btn-primary mt-5" href={feature.button.link}>
|
||||
{feature.button.label}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
)
|
||||
}
|
||||
<!-- /Features -->
|
||||
|
||||
<Testimonial testimonial={testimonial} />
|
||||
<CallToAction call_to_action={call_to_action} />
|
||||
</Base>
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
---
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import PostSingle from "@layouts/PostSingle.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getSinglePage(config.settings.blog_folder);
|
||||
|
||||
const paths = posts.map((post) => ({
|
||||
params: {
|
||||
single: post.slug,
|
||||
},
|
||||
props: { post },
|
||||
}));
|
||||
return paths;
|
||||
}
|
||||
|
||||
const { post } = Astro.props;
|
||||
const { title, meta_title, description, image } = post.data;
|
||||
---
|
||||
|
||||
<Base
|
||||
title={title}
|
||||
meta_title={meta_title}
|
||||
description={description}
|
||||
image={image}
|
||||
>
|
||||
<PostSingle post={post} />
|
||||
</Base>
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
---
|
||||
import BlogCard from "@components/BlogCard.astro";
|
||||
import Pagination from "@components/Pagination.astro";
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import { sortByDate } from "@lib/utils/sortFunctions";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
import PostSidebar from "@partials/PostSidebar.astro";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
const postIndex = await getEntryBySlug<any, string>(blog_folder, "_index");
|
||||
const posts = await getSinglePage(blog_folder);
|
||||
const allCategories = await getAllTaxonomy(blog_folder, "categories");
|
||||
const categories = await getTaxonomy(blog_folder, "categories");
|
||||
const tags = await getTaxonomy(blog_folder, "tags");
|
||||
const sortedPosts = sortByDate(posts);
|
||||
const totalPages = Math.ceil(posts.length / config.settings.pagination);
|
||||
const currentPosts = sortedPosts.slice(0, config.settings.pagination);
|
||||
---
|
||||
|
||||
<Base
|
||||
title={postIndex.data.title}
|
||||
meta_title={postIndex.data.meta_title}
|
||||
image={postIndex.data.image}
|
||||
description={postIndex.data.description}
|
||||
>
|
||||
<PageHeader title={postIndex.data.title} />
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div class="row gx-5">
|
||||
<!-- blog posts -->
|
||||
<div class="lg:col-8">
|
||||
<div class="row">
|
||||
{
|
||||
currentPosts.map((post) => (
|
||||
<div class="mb-14 md:col-6">
|
||||
<BlogCard data={post} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
<Pagination
|
||||
section={blog_folder}
|
||||
currentPage={1}
|
||||
totalPages={totalPages}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- sidebar -->
|
||||
<PostSidebar
|
||||
categories={categories}
|
||||
tags={tags}
|
||||
allCategories={allCategories}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+80
@@ -0,0 +1,80 @@
|
||||
---
|
||||
import BlogCard from "@components/BlogCard.astro";
|
||||
import Pagination from "@components/Pagination.astro";
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import { sortByDate } from "@lib/utils/sortFunctions";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
import PostSidebar from "@partials/PostSidebar.astro";
|
||||
import { getEntryBySlug } from "astro:content";
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
const { slug } = Astro.params;
|
||||
const postIndex = await getEntryBySlug<any, string>(blog_folder, "_index");
|
||||
const posts = await getSinglePage(blog_folder);
|
||||
const allCategories = await getAllTaxonomy(blog_folder, "categories");
|
||||
const categories = await getTaxonomy(blog_folder, "categories");
|
||||
const tags = await getTaxonomy(blog_folder, "tags");
|
||||
const sortedPosts = sortByDate(posts);
|
||||
const totalPages = Math.ceil(posts.length / config.settings.pagination);
|
||||
const currentPage = slug && !isNaN(Number(slug)) ? Number(slug) : 1;
|
||||
const indexOfLastPost = currentPage * config.settings.pagination;
|
||||
const indexOfFirstPost = indexOfLastPost - config.settings.pagination;
|
||||
const currentPosts = sortedPosts.slice(indexOfFirstPost, indexOfLastPost);
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const posts = await getSinglePage(config.settings.blog_folder);
|
||||
const totalPages = Math.ceil(posts.length / config.settings.pagination);
|
||||
const paths = [];
|
||||
|
||||
for (let i = 1; i < totalPages; i++) {
|
||||
paths.push({
|
||||
params: {
|
||||
slug: (i + 1).toString(),
|
||||
},
|
||||
});
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
---
|
||||
|
||||
<Base
|
||||
title={postIndex.data.title}
|
||||
meta_title={postIndex.data.meta_title}
|
||||
image={postIndex.data.image}
|
||||
description={postIndex.data.description}
|
||||
>
|
||||
<PageHeader title={postIndex.data.title} />
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div class="row gx-5">
|
||||
<!-- blog posts -->
|
||||
<div class="lg:col-8">
|
||||
<div class="row">
|
||||
{
|
||||
currentPosts.map((post) => (
|
||||
<div class="mb-14 md:col-6">
|
||||
<BlogCard data={post} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
<Pagination
|
||||
section={blog_folder}
|
||||
currentPage={currentPage}
|
||||
totalPages={totalPages}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- sidebar -->
|
||||
<PostSidebar
|
||||
categories={categories}
|
||||
tags={tags}
|
||||
allCategories={allCategories}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
---
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import Search from "@layouts/Search";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
|
||||
// Retrieve all articles
|
||||
const posts = await getSinglePage(blog_folder);
|
||||
|
||||
// List of items to search in
|
||||
const searchList = posts.map((item) => ({
|
||||
slug: item.slug,
|
||||
data: item.data,
|
||||
content: item.body,
|
||||
}));
|
||||
---
|
||||
|
||||
<Base title={`Search`}>
|
||||
<Search client:load searchList={searchList} />
|
||||
</Base>
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
---
|
||||
import BlogCard from "@components/BlogCard.astro";
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getSinglePage } from "@lib/contentParser.astro";
|
||||
import { getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import taxonomyFilter from "@lib/utils/taxonomyFilter";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const tags = await getTaxonomy(config.settings.blog_folder, "tags");
|
||||
|
||||
return tags.map((tag) => {
|
||||
return {
|
||||
params: { tag },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { tag } = Astro.params;
|
||||
const posts = await getSinglePage(config.settings.blog_folder);
|
||||
const filterByCategories = taxonomyFilter(posts, "tags", tag);
|
||||
---
|
||||
|
||||
<Base title={tag}>
|
||||
<PageHeader title={tag} />
|
||||
<div class="section-sm pb-0">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{
|
||||
filterByCategories.map((post) => (
|
||||
<div class="mb-14 md:col-6 lg:col-4">
|
||||
<BlogCard data={post} />
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Base>
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
---
|
||||
import config from "@config/config.json";
|
||||
import Base from "@layouts/Base.astro";
|
||||
import { getAllTaxonomy, getTaxonomy } from "@lib/taxonomyParser.astro";
|
||||
import { humanize } from "@lib/utils/textConverter";
|
||||
import PageHeader from "@partials/PageHeader.astro";
|
||||
|
||||
const { blog_folder } = config.settings;
|
||||
const tags = await getTaxonomy(blog_folder, "tags");
|
||||
const allTags = await getAllTaxonomy(blog_folder, "tags");
|
||||
---
|
||||
|
||||
<Base title={"Tags"}>
|
||||
<PageHeader title={"Tags"} />
|
||||
<section class="section">
|
||||
<div class="container text-center">
|
||||
<ul class="space-x-4">
|
||||
{
|
||||
tags.map((tag: any) => {
|
||||
const count = allTags.filter((c) => c === tag).length;
|
||||
return (
|
||||
<li class="inline-block">
|
||||
<a
|
||||
href={`/tags/${tag}`}
|
||||
class="rounded bg-theme-light px-4 py-2 text-xl text-dark dark:bg-darkmode-theme-light dark:text-darkmode-dark"
|
||||
>
|
||||
{humanize(tag)}{" "}
|
||||
<span class="ml-2 rounded bg-body px-2 dark:bg-darkmode-body">
|
||||
{count}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
</Base>
|
||||
Reference in New Issue
Block a user