From e505cc92cf53e14db509500106adaf0e3f50c0f1 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Thu, 10 Oct 2024 14:34:52 -0700 Subject: [PATCH 1/3] feat: Custom extras page --- src/content/archives.md | 3 --- src/content/extra/archives.md | 6 ++++++ src/content/metadata.json | 5 ++++- src/lib/sitemap.ts | 5 +++-- src/routes/{archives => [slug]}/+page.svelte | 6 ++++-- src/routes/[slug]/+page.ts | 12 ++++++++++++ src/routes/archives/+page.ts | 11 ----------- 7 files changed, 29 insertions(+), 19 deletions(-) delete mode 100644 src/content/archives.md create mode 100644 src/content/extra/archives.md rename src/routes/{archives => [slug]}/+page.svelte (62%) create mode 100644 src/routes/[slug]/+page.ts delete mode 100644 src/routes/archives/+page.ts diff --git a/src/content/archives.md b/src/content/archives.md deleted file mode 100644 index c2a6133..0000000 --- a/src/content/archives.md +++ /dev/null @@ -1,3 +0,0 @@ -# Archives - -Archives live here diff --git a/src/content/extra/archives.md b/src/content/extra/archives.md new file mode 100644 index 0000000..1746531 --- /dev/null +++ b/src/content/extra/archives.md @@ -0,0 +1,6 @@ +--- +title: Archives Custom Title +--- +# Archives + +Archives live here diff --git a/src/content/metadata.json b/src/content/metadata.json index 3d9974a..64373f9 100644 --- a/src/content/metadata.json +++ b/src/content/metadata.json @@ -8,5 +8,8 @@ "github": "https://github.com", "email": "email:cirno@gensokyo.jp", "orcid": "https://orcid.org/cirno" - } + }, + "extra": [ + { "route": "/archives", "name": "Archives" } + ] } diff --git a/src/lib/sitemap.ts b/src/lib/sitemap.ts index 3b312b9..5dfcf30 100644 --- a/src/lib/sitemap.ts +++ b/src/lib/sitemap.ts @@ -1,7 +1,8 @@ +import siteMetadata from '$content/metadata.json'; + export const routes: { route: string, name: string, disabled?: boolean }[] = [ { route: "/", name: "Home" }, { route: "/post", name: "Blog" }, { route: "/tag", name: "Tags" }, { route: "/gallery", name: "Gallery", disabled: true }, - { route: "/archives", name: "Archives" }, -]; +].concat(siteMetadata?.extra || []); diff --git a/src/routes/archives/+page.svelte b/src/routes/[slug]/+page.svelte similarity index 62% rename from src/routes/archives/+page.svelte rename to src/routes/[slug]/+page.svelte index 8b15211..d175188 100644 --- a/src/routes/archives/+page.svelte +++ b/src/routes/[slug]/+page.svelte @@ -1,12 +1,14 @@ - Archives | {siteMetadata.blogName} + {title} | {siteMetadata.blogName}
diff --git a/src/routes/[slug]/+page.ts b/src/routes/[slug]/+page.ts new file mode 100644 index 0000000..dba9665 --- /dev/null +++ b/src/routes/[slug]/+page.ts @@ -0,0 +1,12 @@ +import type { PageLoad } from './$types'; + +export const load: PageLoad = async ({ params }) => { + const post = await import(`$content/extra/${params.slug}.md`); + const Content = post.default; + + return { + slug: params.slug, + metadata: post.metadata, + Content, + }; +} diff --git a/src/routes/archives/+page.ts b/src/routes/archives/+page.ts deleted file mode 100644 index efeea04..0000000 --- a/src/routes/archives/+page.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { PageLoad } from './$types'; - -export const load: PageLoad = async (_) => { - const post = await import("$content/archives.md"); - const Content = post.default; - - return { - metadata: post.metadata, - Content, - }; -} -- 2.44.1 From e714877e4767247aaa40de12b96a3874e4401066 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Thu, 10 Oct 2024 15:00:12 -0700 Subject: [PATCH 2/3] fix: Layout overflow on narrow screen --- src/routes/+layout.svelte | 1 + src/routes/Navbar.svelte | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7170bf9..8c0ad4f 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -103,6 +103,7 @@ @media (max-width: 700px) { #layout { flex-direction: column; + margin-top: 10px; gap: 20px; } } diff --git a/src/routes/Navbar.svelte b/src/routes/Navbar.svelte index 3857553..c0606fe 100644 --- a/src/routes/Navbar.svelte +++ b/src/routes/Navbar.svelte @@ -35,8 +35,11 @@ } @media (max-width: 700px) { #navbar { - flex-direction: row; - justify-content: start; + display: inline-block; + white-space: pre-wrap; + } + #navbar .nav-link { + display: inline-block; } } -- 2.44.1 From bc40990b52bcbaaa1cb612960bfefe166a1c3e40 Mon Sep 17 00:00:00 2001 From: Leni Aniva Date: Fri, 11 Oct 2024 00:53:35 -0700 Subject: [PATCH 3/3] feat: Enable wrapping of main navbar when its long --- src/routes/+page.svelte | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index f8c035e..340d511 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -48,12 +48,12 @@ class="floater-elem" style="padding-bottom: {(1 - progress) * 50}vh" > -
- Bio + @@ -98,8 +98,8 @@ background-position: center center; z-index: -10; position: fixed; - min-width: 100vw; - min-height: 100vh; + min-width: 100%; + min-height: 100%; overscroll-behaviour: none; } #front { @@ -116,6 +116,10 @@ margin-left: auto; margin-right: auto; } + #navbar { + display: flex; + flex-wrap: wrap; + } .floater-elem { margin-left: auto; margin-right: auto; -- 2.44.1