getfilepress 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -8,7 +8,17 @@ Written **FilePress**. npm **`getfilepress`**. CLI **`filepress`** (same script
|
|
|
8
8
|
|
|
9
9
|
## Start a site
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Shortest path: a folder with `filepress.config.ts` (`title`, `url`), `posts/*.md`, and `"getfilepress": "^0.1.29"` in `package.json`.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install
|
|
15
|
+
pnpm build # → ./build/
|
|
16
|
+
pnpm preview # serve build/, no Genie
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`pnpm dev` is optional (Genie). FilePress does not upload `build/`.
|
|
20
|
+
|
|
21
|
+
From a clone of this repo, scaffold a fuller starter:
|
|
12
22
|
|
|
13
23
|
```bash
|
|
14
24
|
pnpm install
|
|
@@ -18,7 +28,7 @@ cd ../my-blog && pnpm install && pnpm dev
|
|
|
18
28
|
|
|
19
29
|
`filepress new "Title"` stamps `posts/YYYY-MM-DD-slug.md`. Config, frontmatter, images, and commands: [Docs](https://getfilepress.com/docs).
|
|
20
30
|
|
|
21
|
-
Pin CI on npm (`getfilepress` current is `0.1.
|
|
31
|
+
Pin CI on npm (`getfilepress` current is `0.1.29`) or a git SHA / existing tag. `link:` is local only.
|
|
22
32
|
|
|
23
33
|
## Import
|
|
24
34
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { PageData } from './$types';
|
|
3
|
-
import { PostCard } from '@filepress/core';
|
|
3
|
+
import { PostCard, tagDisplayLabel } from '@filepress/core';
|
|
4
4
|
import config from '$site-config';
|
|
5
5
|
|
|
6
6
|
let { data }: { data: PageData } = $props();
|
|
7
|
+
const heading = $derived(tagDisplayLabel(config.topics, data.tag));
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
<svelte:head>
|
|
10
|
-
<title>{
|
|
11
|
-
<meta name="description" content="Posts tagged {
|
|
11
|
+
<title>{heading} — {config.title}</title>
|
|
12
|
+
<meta name="description" content="Posts tagged {heading} on {config.title}." />
|
|
12
13
|
</svelte:head>
|
|
13
14
|
|
|
14
15
|
<header class="post-header">
|
|
15
|
-
<
|
|
16
|
-
<h1>{data.tag}</h1>
|
|
16
|
+
<h1>{heading}</h1>
|
|
17
17
|
</header>
|
|
18
18
|
|
|
19
19
|
<ul class="post-list">
|
|
@@ -34,3 +34,17 @@ export function readingMinutes(body: string, wordsPerMinute = 228): number {
|
|
|
34
34
|
export function formatReadingTime(minutes: number): string {
|
|
35
35
|
return minutes === 1 ? '1 min read' : `${minutes} min read`;
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
/** Display name for a tag: curated topic label, else title-cased slug. */
|
|
39
|
+
export function tagDisplayLabel(
|
|
40
|
+
topics: Array<{ label: string; tag: string }>,
|
|
41
|
+
tag: string
|
|
42
|
+
): string {
|
|
43
|
+
const curated = topics.find((topic) => topic.tag === tag)?.label.trim();
|
|
44
|
+
if (curated) return curated;
|
|
45
|
+
return tag
|
|
46
|
+
.split('-')
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
49
|
+
.join(' ');
|
|
50
|
+
}
|
|
@@ -32,6 +32,6 @@ export type {
|
|
|
32
32
|
|
|
33
33
|
export { isPathMountHref } from './paths-shared';
|
|
34
34
|
|
|
35
|
-
export { formatDate, formatReadingTime, readingMinutes } from './format';
|
|
35
|
+
export { formatDate, formatReadingTime, readingMinutes, tagDisplayLabel } from './format';
|
|
36
36
|
|
|
37
37
|
export type { PostMeta, PostSource, RenderedPost, RawFrontmatter } from './content/types';
|