From 707f55989a614d9ba249aa207d44116baf77d2db Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Thu, 30 May 2024 21:35:07 +0200 Subject: [PATCH] feat: seo and image stuff ig --- {src => public}/backgrounds.json | 0 src/components/BaseHead.astro | 6 +-- src/layouts/BlogPost.astro | 2 +- src/pages/index.astro | 65 ++++++++++++++++---------------- 4 files changed, 37 insertions(+), 36 deletions(-) rename {src => public}/backgrounds.json (100%) diff --git a/src/backgrounds.json b/public/backgrounds.json similarity index 100% rename from src/backgrounds.json rename to public/backgrounds.json diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 5aac24f..d74a838 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -11,7 +11,7 @@ interface Props { const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; +const { title, description, image } = Astro.props; --- @@ -37,11 +37,11 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; - + - + diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 19751f4..5bf6fd7 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -12,7 +12,7 @@ const { title, excerpt: description, published_at, updated_at, feature_image, fe - + diff --git a/src/pages/index.astro b/src/pages/index.astro index 930f40d..3d2f901 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,39 +1,40 @@ --- -import BaseHead from '../components/BaseHead.astro'; -import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; -import Backgrounds from '../backgrounds.json'; -import { Image } from 'astro:assets'; -import ImageAuthor from '@/components/ImageAuthor.astro'; -import { FaGithub, FaBlog, FaDiscord, FaMastodon, FaTwitter } from 'react-icons/fa'; -import { SiOsu } from 'react-icons/si'; +import BaseHead from '../components/BaseHead.astro' +import { SITE_TITLE, SITE_DESCRIPTION } from '../consts' +import { Image } from 'astro:assets' +import ImageAuthor from '@/components/ImageAuthor.astro' +import { FaGithub, FaBlog, FaDiscord, FaMastodon, FaTwitter } from 'react-icons/fa' +import { SiOsu } from 'react-icons/si' -const randomBackground = Backgrounds[Math.floor(Math.random() * Backgrounds.length)]; +const fetchBackgrond = await fetch(`${Astro.url}/backgrounds.json`).then(async res => await res.json()) + +const randomBackground = fetchBackgrond[Math.floor(Math.random() * fetchBackgrond.length)] --- - - - - - -
+ + + + + +
-
- {'pfp'} -

Hobbyist developer & sern lead developer team member

-
- - - - - - -
-
- - \ No newline at end of file +
+ {'pfp'} +

Hobbyist developer & sern lead developer team member

+
+ + + + + + +
+
+ +