Skip to content

Commit

Permalink
rename type to category, falls back to folder if not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Jun 13, 2024
1 parent 169509f commit 71fcbb8
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 27 deletions.
10 changes: 9 additions & 1 deletion .vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import matter from "gray-matter";
import { fileURLToPath } from "url";
import metaTags from "./meta";

function toTitleCase(str?: string) {
if (!str) return str;
return str
.split(/-|_| /g)
.map((word) => word[0].toUpperCase() + word.slice(1))
.join(" ");
}

/**
* Return an array of all filepaths in a directory
* @author Juknum, Evorp
Expand Down Expand Up @@ -42,7 +50,7 @@ function computeBars() {
};
})
.reduce((acc, cur) => {
const category = cur.frontmatter.type;
const category = cur.frontmatter.category || toTitleCase(cur.link.split("/").at(-2));

// delete because unused
delete (cur as any).frontmatter;
Expand Down
2 changes: 1 addition & 1 deletion pages/dungeons/alpha-img.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Alpha Textures"
type: "Dungeons"
category: "Dungeons"
date: "2020-08-03"
archived: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/dungeons/items-tutorial.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Items Tutorial"
type: "Dungeons"
category: "Dungeons"
date: "2020-09-09"
archived: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/dungeons/loader-texture.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Loader Texture"
type: "Dungeons"
category: "Dungeons"
date: "2020-08-09"
archived: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/manuals/add-on-rules.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Rules for Add-ons"
type: "Manuals"
category: "Manuals"
date: "2022-08-13"
---

Expand Down
2 changes: 1 addition & 1 deletion pages/manuals/branding-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Faithful Branding Guidelines"
type: "Manuals"
category: "Manuals"
date: "2023-09-13"
---

Expand Down
2 changes: 1 addition & 1 deletion pages/manuals/contributor-handbook.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "The Faithful Contributor's Handbook"
type: "Manuals"
category: "Manuals"
date: "2022-03-23"
---

Expand Down
2 changes: 1 addition & 1 deletion pages/manuals/expanded-server-rules.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Expanded Server Rules"
type: "Manuals"
category: "Manuals"
date: "2022-10-23"
---

Expand Down
4 changes: 2 additions & 2 deletions pages/manuals/new-doc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Write a Doc"
type: "Manuals"
category: "Manuals"
date: "2021-07-19"
---

Expand All @@ -18,7 +18,7 @@ Below you can see an example.
```yaml
---
title: "Your title here"
type: "Docs"
category: "Docs" # optional, falls back to folder name
date: "yyyy-mm-dd"
deprecated: false # optional
archived: false # optional
Expand Down
2 changes: 1 addition & 1 deletion pages/mods/add-new-mod.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Add new Mod"
type: "Mods"
category: "Mods"
date: "2021-04-11"
deprecated: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/mods/add-new-version.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Add new Minecraft version"
type: "Mods"
category: "Mods"
date: "2020-12-02"
deprecated: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/mods/add-textures-commands.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Add textures: with commands"
type: "Mods"
category: "Mods"
date: "2020-12-02"
deprecated: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/mods/add-textures.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Add textures"
type: "Mods"
category: "Mods"
date: "2020-12-02"
deprecated: true
---
Expand Down
2 changes: 1 addition & 1 deletion pages/textures/cf32-texturing-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Classic Faithful 32x Texturing Guidelines"
type: "Textures"
category: "Textures"
date: "2022-08-22"
---

Expand Down
2 changes: 1 addition & 1 deletion pages/textures/f32-texturing-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Faithful 32x Texturing Guidelines"
type: "Textures"
category: "Textures"
date: "2022-03-19"
---

Expand Down
2 changes: 1 addition & 1 deletion pages/textures/f64-texturing-guidelines.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Faithful 64x Texturing Guidelines"
type: "Textures"
category: "Textures"
date: "2023-09-27"
---

Expand Down
16 changes: 6 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 71fcbb8

Please sign in to comment.