Read categories and tags from different file

This commit is contained in:
Maciej Pędzich 2023-08-24 23:17:05 +02:00
parent fd93a73d31
commit c6566812c6
6 changed files with 28 additions and 9 deletions

View File

@ -1 +1,16 @@
{"taxonomy":{"tags":["appwrite","formulaone","linux","planning","racemash","self-hosted","vue","vuetify"],"categories":["dev diary","learning modern linux"]}}
{
"taxonomy": {
"tags": [
"appwrite",
"formulaone",
"linux",
"notes",
"planning",
"racemash",
"self-hosted",
"vue",
"vuetify"
],
"categories": ["dev diary", "learning modern linux"]
}
}

4
.markdownlint.json Normal file
View File

@ -0,0 +1,4 @@
{
"MD040": false,
"MD013": false
}

View File

@ -3,10 +3,10 @@ import type { CollectionEntry } from 'astro:content';
import BlogSubpage from '../../../layouts/BlogSubpage.astro';
import PostList from '../../../components/PostList.astro';
import frontMatterConfig from '../../../../frontmatter.json';
import taxonomyDb from '../../../../.frontmatter/database/taxonomyDb.json';
export function getStaticPaths() {
const categories = frontMatterConfig['frontMatter.taxonomy.categories'];
const { categories } = taxonomyDb.taxonomy;
return categories.map((category) => ({ params: { category } }));
}

View File

@ -1,8 +1,8 @@
---
import BlogSubpage from '../../../layouts/BlogSubpage.astro';
import frontMatterConfig from '../../../../frontmatter.json';
import taxonomyDb from '../../../../.frontmatter/database/taxonomyDb.json';
const categories = frontMatterConfig['frontMatter.taxonomy.categories'];
const { categories } = taxonomyDb.taxonomy;
---
<BlogSubpage title="tags" description="all categories of maciej's blog posts">

View File

@ -3,10 +3,10 @@ import type { CollectionEntry } from 'astro:content';
import BlogSubpage from '../../../layouts/BlogSubpage.astro';
import PostList from '../../../components/PostList.astro';
import frontMatterConfig from '../../../../frontmatter.json';
import taxonomyDb from '../../../../.frontmatter/database/taxonomyDb.json';
export function getStaticPaths() {
const tags = frontMatterConfig['frontMatter.taxonomy.tags'];
const { tags } = taxonomyDb.taxonomy;
return tags.map((tag) => ({ params: { tag } }));
}

View File

@ -1,8 +1,8 @@
---
import BlogSubpage from '../../../layouts/BlogSubpage.astro';
import frontMatterConfig from '../../../../frontmatter.json';
import taxonomyDb from '../../../../.frontmatter/database/taxonomyDb.json';
const tags = frontMatterConfig['frontMatter.taxonomy.tags'];
const { tags } = taxonomyDb.taxonomy;
---
<BlogSubpage title="tags" description="all tags of maciej's blog posts">