From ea4a453e25ac1bd1cb81aa3a7fade0e7ff3b5e9a Mon Sep 17 00:00:00 2001 From: saicaca Date: Wed, 18 Oct 2023 21:24:51 +0800 Subject: [PATCH] feat: minor fixes --- fuwari.config.yml | 2 +- package-lock.json | 2 +- package.json | 2 +- src/components/ArchivePanel.astro | 8 +- src/components/Footer.astro | 2 +- src/content/config.ts | 9 +- src/content/posts/{example2.md => cover.md} | 9 +- src/content/posts/example.md | 28 ---- src/content/posts/example3.md | 27 ---- src/content/posts/example4.md | 27 ---- src/content/posts/markdown.md | 168 ++++++++++++++++++++ src/content/spec/about.md | 2 + src/pages/posts/[slug].astro | 7 +- src/utils/config-utils.ts | 4 +- 14 files changed, 193 insertions(+), 104 deletions(-) rename src/content/posts/{example2.md => cover.md} (75%) delete mode 100644 src/content/posts/example.md delete mode 100644 src/content/posts/example3.md delete mode 100644 src/content/posts/example4.md create mode 100644 src/content/posts/markdown.md diff --git a/fuwari.config.yml b/fuwari.config.yml index 2b0d3b0..b5c69cd 100644 --- a/fuwari.config.yml +++ b/fuwari.config.yml @@ -26,4 +26,4 @@ profile: url: https://store.steampowered.com - name: GitHub icon: fa6-brands:github - url: https://github.com \ No newline at end of file + url: https://github.com/saicaca/fuwari \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index fea15be..dda079e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "astro-vivia", + "name": "fuwari", "version": "0.0.1", "lockfileVersion": 3, "requires": true, diff --git a/package.json b/package.json index 09e0793..09de49a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "", + "name": "fuwari", "type": "module", "version": "0.0.1", "scripts": { diff --git a/src/components/ArchivePanel.astro b/src/components/ArchivePanel.astro index 30749e1..12b9953 100644 --- a/src/components/ArchivePanel.astro +++ b/src/components/ArchivePanel.astro @@ -51,9 +51,9 @@ function formatDate(date: Date) { return `${month}-${day}`; } - -// console.log(groups) - +function formatTag(tag: string[]) { + return tag.map(t => `#${t}`).join(' '); +} --- @@ -96,7 +96,7 @@ function formatDate(date: Date) {
#Test #Markdown
+ >{formatTag(post.data.tags)} diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 527fd59..842c5e5 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -8,6 +8,6 @@ import {getConfig} from "../utils/config-utils";
© 2023 {getConfig().profile.author}. All Rights Reserved.
- Powered by Vivia + Powered by Fuwari
\ No newline at end of file diff --git a/src/content/config.ts b/src/content/config.ts index 40cc013..5d8c8c1 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -3,8 +3,13 @@ import { z, defineCollection } from "astro:content"; const blogCollection = defineCollection({ schema: z.object({ title: z.string(), - tags: z.array(z.string()), - cover: z.string().optional(), + published: z.date(), + description: z.string().optional(), + cover: z.object({ + url: z.string(), + alt: z.string(), + }), + tags: z.array(z.string()).optional(), }) }) export const collections = { diff --git a/src/content/posts/example2.md b/src/content/posts/cover.md similarity index 75% rename from src/content/posts/example2.md rename to src/content/posts/cover.md index f6af761..27aab00 100644 --- a/src/content/posts/example2.md +++ b/src/content/posts/cover.md @@ -1,12 +1,11 @@ --- -title: 'My Second Blog Post' -published: 2021-07-01 -description: 'This is the first post of my new Astro blog.' -author: 'Astro Learner' +title: 'Cover Image Example' +published: 2022-09-09 +description: 'How to set a cover image using the cover attribute.' cover: url: 'https://saicaca.github.io/vivia-preview/assets/79905307_p0.jpg' alt: -tags: ["astro", "blogging", "learning in public"] +tags: ["Fuwari", "Blogging", "Customization"] --- # My First Blog Post diff --git a/src/content/posts/example.md b/src/content/posts/example.md deleted file mode 100644 index 77b5c62..0000000 --- a/src/content/posts/example.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: 'My First Blog Post' -published: 2022-10-01 -description: 'This is the first post of my new Astro blog.' -author: 'Astro Learner' -cover: - url: - alt: -tags: ["astro", "blogging", "learning in public"] -categories: ['Foo', 'Bar'] ---- -# My First Blog Post - -Published on: 2022-07-01 - -Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website. - -## What I've accomplished - -1. **Installing Astro**: First, I created a new Astro project and set up my online accounts. - -2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder. - -3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts! - -## What's next - -I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come. \ No newline at end of file diff --git a/src/content/posts/example3.md b/src/content/posts/example3.md deleted file mode 100644 index 7cf3192..0000000 --- a/src/content/posts/example3.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: 'My Third Blog Post' -published: 2020-07-01 -description: 'This is the first post of my new Astro blog.' -author: 'Astro Learner' -cover: - url: - alt: -tags: ["astro", "blogging", "learning in public"] ---- -# My First Blog Post - -Published on: 2022-07-01 - -Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website. - -## What I've accomplished - -1. **Installing Astro**: First, I created a new Astro project and set up my online accounts. - -2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder. - -3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts! - -## What's next - -I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come. \ No newline at end of file diff --git a/src/content/posts/example4.md b/src/content/posts/example4.md deleted file mode 100644 index 6ae359f..0000000 --- a/src/content/posts/example4.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: 'My Fourth Blog Post' -published: 2022-07-01 -description: 'This is the first post of my new Astro blog.' -author: 'Astro Learner' -cover: - url: - alt: -tags: ["astro", "blogging", "learning in public"] ---- -# My First Blog Post - -Published on: 2022-07-01 - -Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website. - -## What I've accomplished - -1. **Installing Astro**: First, I created a new Astro project and set up my online accounts. - -2. **Making Pages**: I then learned how to make pages by creating new `.astro` files and placing them in the `src/pages/` folder. - -3. **Making Blog Posts**: This is my first blog post! I now have Astro pages and Markdown posts! - -## What's next - -I will finish the Astro tutorial, and then keep adding more posts. Watch this space for more to come. \ No newline at end of file diff --git a/src/content/posts/markdown.md b/src/content/posts/markdown.md new file mode 100644 index 0000000..44c23c4 --- /dev/null +++ b/src/content/posts/markdown.md @@ -0,0 +1,168 @@ +--- +title: Markdown Example +published: 2023-10-18 +description: A simple example of a Markdown blog post. +cover: + url: + alt: +tags: [Markdown, Blogging, Demo] +categories: [Example] +--- + +An h1 header +============ + +Paragraphs are separated by a blank line. + +2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists +look like: + +* this one +* that one +* the other one + +Note that --- not considering the asterisk --- the actual text +content starts at 4-columns in. + +> Block quotes are +> written like so. +> +> They can span multiple paragraphs, +> if you like. + +Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., "it's all +in chapters 12--14"). Three dots ... will be converted to an ellipsis. +Unicode is supported. ☺ + + + +An h2 header +------------ + +Here's a numbered list: + +1. first item +2. second item +3. third item + +Note again how the actual text starts at 4 columns in (4 characters +from the left side). Here's a code sample: + + # Let me re-iterate ... + for i in 1 .. 10 { do-something(i) } + +As you probably guessed, indented 4 spaces. By the way, instead of +indenting the block, you can use delimited blocks, if you like: + +~~~ +define foobar() { + print "Welcome to flavor country!"; +} +~~~ + +(which makes copying & pasting easier). You can optionally mark the +delimited block for Pandoc to syntax highlight it: + +~~~python +import time +# Quick, count to ten! +for i in range(10): + # (but not *too* quick) + time.sleep(0.5) + print i +~~~ + + + +### An h3 header ### + +Now a nested list: + +1. First, get these ingredients: + + * carrots + * celery + * lentils + +2. Boil some water. + +3. Dump everything in the pot and follow + this algorithm: + + find wooden spoon + uncover pot + stir + cover pot + balance wooden spoon precariously on pot handle + wait 10 minutes + goto first step (or shut off burner when done) + + Do not bump wooden spoon or it will fall. + +Notice again how text always lines up on 4-space indents (including +that last line which continues item 3 above). + +Here's a link to [a website](http://foo.bar), to a [local +doc](local-doc.html), and to a [section heading in the current +doc](#an-h2-header). Here's a footnote [^1]. + +[^1]: Footnote text goes here. + +Tables can look like this: + +size material color +---- ------------ ------------ +9 leather brown +10 hemp canvas natural +11 glass transparent + +Table: Shoes, their sizes, and what they're made of + +(The above is the caption for the table.) Pandoc also supports +multi-line tables: + +-------- ----------------------- +keyword text +-------- ----------------------- +red Sunsets, apples, and +other red or reddish +things. + +green Leaves, grass, frogs +and other things it's +not easy being. +-------- ----------------------- + +A horizontal rule follows. + +*** + +Here's a definition list: + +apples +: Good for making applesauce. +oranges +: Citrus! +tomatoes +: There's no "e" in tomatoe. + +Again, text is indented 4 spaces. (Put a blank line between each +term/definition pair to spread things out more.) + +Here's a "line block": + +| Line one +| Line too +| Line tree + +and images can be specified like so: + +![example image](/images/demo-banner.jpg "An exemplary image") + +Inline math equations go in like so: $\omega = d\phi / dt$. Display +math should get its own line and be put in in double-dollarsigns: + +$$I = \int \rho R^{2} dV$$ + +And note that you can backslash-escape any punctuation characters +which you wish to be displayed literally, ex.: \`foo\`, \*bar\*, etc. \ No newline at end of file diff --git a/src/content/spec/about.md b/src/content/spec/about.md index e69de29..5b0691e 100644 --- a/src/content/spec/about.md +++ b/src/content/spec/about.md @@ -0,0 +1,2 @@ +## About +This is the about page. diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro index 0968766..1713de8 100644 --- a/src/pages/posts/[slug].astro +++ b/src/pages/posts/[slug].astro @@ -104,10 +104,6 @@ const { remarkPluginFrontmatter } = await entry.render(); - - - - \ No newline at end of file diff --git a/src/utils/config-utils.ts b/src/utils/config-utils.ts index 9d98bb1..5a3cc7a 100644 --- a/src/utils/config-utils.ts +++ b/src/utils/config-utils.ts @@ -1,7 +1,7 @@ // @ts-ignore import _config from '../../fuwari.config.yml'; -interface ViviaConfig { +interface FuwariConfig { title: string; menu: { [key: string]: string; @@ -35,6 +35,6 @@ interface ViviaConfig { } } -const config: ViviaConfig = _config; +const config: FuwariConfig = _config; export const getConfig = () => config; \ No newline at end of file