From cad53f806a1604201514ab4441e8f4df652290a6 Mon Sep 17 00:00:00 2001 From: Dempsey Palacio Tascon Date: Sun, 8 Dec 2024 23:44:56 +0000 Subject: [PATCH 1/7] blog home page working --- .vscode/settings.json | 5 +++++ src/components/blog/BlogPostList.astro | 21 +++++++++++++++++++++ src/components/blog/PostHero.astro | 17 +++++++++++++++++ src/pages/blog.astro | 9 --------- src/pages/blog/index.astro | 10 ++++++++++ src/pages/blog/posts/test.md | 13 +++++++++++++ 6 files changed, 66 insertions(+), 9 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 src/components/blog/BlogPostList.astro create mode 100644 src/components/blog/PostHero.astro delete mode 100644 src/pages/blog.astro create mode 100644 src/pages/blog/index.astro create mode 100644 src/pages/blog/posts/test.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cc04d1f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "cSpell.enabledSchemes": { + "file": false + } +} \ No newline at end of file diff --git a/src/components/blog/BlogPostList.astro b/src/components/blog/BlogPostList.astro new file mode 100644 index 0000000..9c7a2f7 --- /dev/null +++ b/src/components/blog/BlogPostList.astro @@ -0,0 +1,21 @@ +--- +import PostHero from "./PostHero.astro" +const posts : any = Object.values(await import.meta.glob('../../pages/blog/posts/*.md', {eager: true})); +--- + +
+

Posts

+ +
\ No newline at end of file diff --git a/src/components/blog/PostHero.astro b/src/components/blog/PostHero.astro new file mode 100644 index 0000000..263fa50 --- /dev/null +++ b/src/components/blog/PostHero.astro @@ -0,0 +1,17 @@ +--- +interface Props { + title : string, + description : string, + author : string, + date : string, + link : string, +} +const {title, description, author,date, link} = Astro.props; +--- + + +

{title}

+

{description}

+

{author}

+

{date}

+
\ No newline at end of file diff --git a/src/pages/blog.astro b/src/pages/blog.astro deleted file mode 100644 index 6e7c6af..0000000 --- a/src/pages/blog.astro +++ /dev/null @@ -1,9 +0,0 @@ ---- -import Layout from "../layouts/Layout.astro"; -import Navbar from "../components/Navbar.astro"; ---- - - - -

Blog Page

-
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro new file mode 100644 index 0000000..ad48167 --- /dev/null +++ b/src/pages/blog/index.astro @@ -0,0 +1,10 @@ +--- +import Layout from "../../layouts/Layout.astro"; +import Navbar from "../../components/Navbar.astro"; +import BlogPostList from "../../components/blog/BlogPostList.astro"; +--- + + + + + diff --git a/src/pages/blog/posts/test.md b/src/pages/blog/posts/test.md new file mode 100644 index 0000000..530f416 --- /dev/null +++ b/src/pages/blog/posts/test.md @@ -0,0 +1,13 @@ +--- +title: "Title" +description: "Example of Format for blog posts" +author: "deej-tsn" +date: "8th Dec" +--- + +# Testing + +## header 1 +content part 1 +## header 2 +content part 2 \ No newline at end of file From 5ada29ee1c62c38f0d8f0ea6a100d019e5f27edf Mon Sep 17 00:00:00 2001 From: Dempsey Palacio Tascon Date: Sun, 8 Dec 2024 23:48:14 +0000 Subject: [PATCH 2/7] format fix --- src/components/blog/BlogPostList.astro | 34 ++++++++++++++------------ src/components/blog/PostHero.astro | 22 ++++++++++------- src/pages/blog/index.astro | 2 +- src/pages/blog/posts/test.md | 7 ++++-- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/components/blog/BlogPostList.astro b/src/components/blog/BlogPostList.astro index 9c7a2f7..a701a4a 100644 --- a/src/components/blog/BlogPostList.astro +++ b/src/components/blog/BlogPostList.astro @@ -1,21 +1,23 @@ --- -import PostHero from "./PostHero.astro" -const posts : any = Object.values(await import.meta.glob('../../pages/blog/posts/*.md', {eager: true})); +import PostHero from "./PostHero.astro"; +const posts: any = Object.values( + await import.meta.glob("../../pages/blog/posts/*.md", { eager: true }), +); --- -
-

Posts

-
    - {posts.map((post: any )=> - - - ) +
    +

    Posts

    +
      + { + posts.map((post: any) => ( + + )) }
    -
    \ No newline at end of file +
diff --git a/src/components/blog/PostHero.astro b/src/components/blog/PostHero.astro index 263fa50..724568e 100644 --- a/src/components/blog/PostHero.astro +++ b/src/components/blog/PostHero.astro @@ -1,17 +1,21 @@ --- interface Props { - title : string, - description : string, - author : string, - date : string, - link : string, + title: string; + description: string; + author: string; + date: string; + link: string; } -const {title, description, author,date, link} = Astro.props; +const { title, description, author, date, link } = Astro.props; --- - -

{title}

+
+

{title}

{description}

{author}

{date}

-
\ No newline at end of file + diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index ad48167..355f81f 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -6,5 +6,5 @@ import BlogPostList from "../../components/blog/BlogPostList.astro"; - + diff --git a/src/pages/blog/posts/test.md b/src/pages/blog/posts/test.md index 530f416..0cdec44 100644 --- a/src/pages/blog/posts/test.md +++ b/src/pages/blog/posts/test.md @@ -1,5 +1,5 @@ --- -title: "Title" +title: "Title" description: "Example of Format for blog posts" author: "deej-tsn" date: "8th Dec" @@ -8,6 +8,9 @@ date: "8th Dec" # Testing ## header 1 + content part 1 + ## header 2 -content part 2 \ No newline at end of file + +content part 2 From 66c05a369f5989cc498df18111b4f6c928834e2a Mon Sep 17 00:00:00 2001 From: Dempsey Palacio Tascon Date: Sun, 8 Dec 2024 23:59:08 +0000 Subject: [PATCH 3/7] fixed type from any to custom post type --- src/components/blog/BlogPostList.astro | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/blog/BlogPostList.astro b/src/components/blog/BlogPostList.astro index a701a4a..fdd9c67 100644 --- a/src/components/blog/BlogPostList.astro +++ b/src/components/blog/BlogPostList.astro @@ -1,6 +1,15 @@ --- +type Post = { + frontmatter: { + title: string, + description: string, + author: string, + date: string, + } + url: string, +} import PostHero from "./PostHero.astro"; -const posts: any = Object.values( +const posts: Post[] = Object.values( await import.meta.glob("../../pages/blog/posts/*.md", { eager: true }), ); --- @@ -9,7 +18,7 @@ const posts: any = Object.values(

Posts

    { - posts.map((post: any) => ( + posts.map((post: Post) => ( Date: Mon, 9 Dec 2024 00:00:40 +0000 Subject: [PATCH 4/7] format fix --- src/components/blog/BlogPostList.astro | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/blog/BlogPostList.astro b/src/components/blog/BlogPostList.astro index fdd9c67..17932be 100644 --- a/src/components/blog/BlogPostList.astro +++ b/src/components/blog/BlogPostList.astro @@ -1,13 +1,13 @@ --- type Post = { frontmatter: { - title: string, - description: string, - author: string, - date: string, - } - url: string, -} + title: string; + description: string; + author: string; + date: string; + }; + url: string; +}; import PostHero from "./PostHero.astro"; const posts: Post[] = Object.values( await import.meta.glob("../../pages/blog/posts/*.md", { eager: true }), From 7c01cb20c05128be431f863d7df685421ccd607c Mon Sep 17 00:00:00 2001 From: deej-tsn <55005502+deej-tsn@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:02:16 +0000 Subject: [PATCH 5/7] Delete .vscode/settings.json --- .vscode/settings.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cc04d1f..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "cSpell.enabledSchemes": { - "file": false - } -} \ No newline at end of file From 186b250fcd7a50cdbf1562372a3e3861044cddb3 Mon Sep 17 00:00:00 2001 From: Dempsey Palacio Tascon Date: Tue, 21 Jan 2025 19:52:31 +0000 Subject: [PATCH 6/7] added uk --- src/pages/index.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index e46dc33..537c149 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -16,7 +16,7 @@ import Navbar from "../components/Navbar.astro";

    freeCodeCamp LondonLondon UK

    Date: Tue, 21 Jan 2025 19:55:36 +0000 Subject: [PATCH 7/7] fixed formatting and removed uk --- src/pages/index.astro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/index.astro b/src/pages/index.astro index 537c149..e46dc33 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -16,7 +16,7 @@ import Navbar from "../components/Navbar.astro";

    freeCodeCamp London UK London