From 0dad47a6ab29afa76f8d17545e09f684b8372911 Mon Sep 17 00:00:00 2001 From: Firq Date: Wed, 8 Mar 2023 20:53:38 +0100 Subject: [PATCH] Implementing Blog --- .gitlab-ci.yml | 4 +-- src/components/blogCard.astro | 68 +++++++++++++++++++++++++++++++++++ src/layouts/blogPost.astro | 66 ++++++++++++++++++++++++++++++++++ src/layouts/blogSection.astro | 33 +++++++++++++++++ src/pages/blog.astro | 10 +++--- src/pages/blog/hello-world.md | 54 ++++++++++++++++++++++++++++ 6 files changed, 228 insertions(+), 7 deletions(-) create mode 100644 src/components/blogCard.astro create mode 100644 src/layouts/blogPost.astro create mode 100644 src/layouts/blogSection.astro create mode 100644 src/pages/blog/hello-world.md diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e21d9d..dbe7007 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,5 +27,5 @@ deploy-site: - chmod 644 ~/.ssh/known_hosts script: - - echo "Connecting to proxmox machine" - - ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*; cd build; git pull; rm -r -f node_modules; npm install; npm run build; cp -R public ~; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000" \ No newline at end of file + - echo "Connecting to proxmox machine" + - ssh $DEPLOY_USER@$DEPLOY_HOST -o StrictHostKeyChecking=no IdentitiesOnly=yes "screen -X -S website-firq-npx kill; rm -r -f public/*; cd build; git pull; rm -r -f node_modules; npm install; npm run build; cp -R public ~; cd ~; screen -S website-firq-npx -dm npx serve public/ -p 9000" \ No newline at end of file diff --git a/src/components/blogCard.astro b/src/components/blogCard.astro new file mode 100644 index 0000000..8286454 --- /dev/null +++ b/src/components/blogCard.astro @@ -0,0 +1,68 @@ +--- +export interface Props { + url: string | undefined; + title: string; + pubdate: string; + description: string; +} + +const options_date: Intl.DateTimeFormatOptions = { + year: "numeric", + month: "long", + day: "2-digit", +} +const { description, pubdate, url, title } = Astro.props; +const date = new Date(pubdate).toLocaleDateString('en-GB', options_date); +--- + + +
+

{title}

+

{date}

+

{description}

+
+
+ + \ No newline at end of file diff --git a/src/layouts/blogPost.astro b/src/layouts/blogPost.astro new file mode 100644 index 0000000..0f581f7 --- /dev/null +++ b/src/layouts/blogPost.astro @@ -0,0 +1,66 @@ +--- +import Layout from "./Layout.astro"; +const { frontmatter } = Astro.props; + +const title = `${frontmatter.title} - Firq FGO Site`; +const description = frontmatter.description; +const options_date: Intl.DateTimeFormatOptions = { + year: "numeric", + month: "long", + day: "2-digit", +} +const date = new Date(frontmatter.pubDate).toLocaleDateString('en-GB', options_date); +--- + + +
+

+ {frontmatter.title} +

+

by {frontmatter.author} • Published on {date}

+
+ +
+
+
+ + \ No newline at end of file diff --git a/src/layouts/blogSection.astro b/src/layouts/blogSection.astro new file mode 100644 index 0000000..d4630e8 --- /dev/null +++ b/src/layouts/blogSection.astro @@ -0,0 +1,33 @@ +--- +export interface Props { + title: string; +} + +const { title } = Astro.props; +--- + +
+

{title}

+
+ +
+
+ + \ No newline at end of file diff --git a/src/pages/blog.astro b/src/pages/blog.astro index d53ec4d..372737c 100644 --- a/src/pages/blog.astro +++ b/src/pages/blog.astro @@ -1,16 +1,16 @@ --- import Layout from '../layouts/Layout.astro'; +import BlogCard from '../components/blogCard.astro'; import BasicSection from '../layouts/basicSection.astro'; -const description = "A placeholder until I get to designing the Blog pages. Future topics will include FGO, TA, Programming, web technologies and more!" +const description = "My own small blog. Topics include FGO, TA, Programming, web technologies and more!" +const allPosts = await Astro.glob("../pages/blog/*.md"); --- - - Nothing to see here (yet)
- Topics will range from FGO to technologies and programming. + + {allPosts.map((post) => )} -