From 106cd931f05e2b13bf753fa31ddded562e99e88a Mon Sep 17 00:00:00 2001 From: prototypa Date: Sun, 21 Jan 2024 21:35:25 -0500 Subject: [PATCH] Small adjustments associated with Relative Posts --- .vscode/astrowind/config-schema.json | 6 ++++++ README.md | 10 ++++++---- package.json | 2 +- src/components/blog/ListItem.astro | 19 +++++++++++-------- src/components/blog/SinglePost.astro | 28 +++++++++++----------------- src/config.yaml | 5 +++-- src/utils/config.ts | 2 ++ 7 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.vscode/astrowind/config-schema.json b/.vscode/astrowind/config-schema.json index 2867fdc..e9c6c2d 100644 --- a/.vscode/astrowind/config-schema.json +++ b/.vscode/astrowind/config-schema.json @@ -128,6 +128,12 @@ "postsPerPage": { "type": "integer" }, + "isRelatedPostsEnabled": { + "type": "boolean" + }, + "relatedPostsCount": { + "type": "integer" + }, "post": { "type": "object", "properties": { diff --git a/README.md b/README.md index 45209f9..6ff4c0c 100644 --- a/README.md +++ b/README.md @@ -119,8 +119,7 @@ There's nothing special about `src/components/`, but that's where we like to put Any static assets, like images, can be placed in the `public/` directory if they do not require any transformation or in the `assets/` directory if they are imported directly. - -[![Edit AstroWind on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://githubbox.com/onwidget/astrowind/tree/main) [![Open in Gitpod](https://svgshare.com/i/xdi.svg)](https://gitpod.io/?on=gitpod#https://github.com/onwidget/astrowind) [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/onwidget/astrowind) +[![Edit AstroWind on CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://githubbox.com/onwidget/astrowind/tree/main) [![Open in Gitpod](https://svgshare.com/i/xdi.svg)](https://gitpod.io/?on=gitpod#https://github.com/onwidget/astrowind) [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/onwidget/astrowind) > 🧑‍🚀 **Seasoned astronaut?** Delete this file `README.md`. Update `src/config.yaml` and contents. Have fun! @@ -182,8 +181,8 @@ i18n: apps: blog: - isEnabled: true - postsPerPage: 6 + isEnabled: true # If the blog will be enabled + postsPerPage: 6 # Number of posts per page post: isEnabled: true @@ -209,6 +208,9 @@ apps: robots: index: false + isRelatedPostsEnabled: true # If a widget with related posts is to be displayed below each post + relatedPostsCount: 4 # Number of related posts to display + analytics: vendors: googleAnalytics: diff --git a/package.json b/package.json index 1c3bfc6..ffd7101 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@onwidget/astrowind", "description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.", - "version": "1.0.0-beta.13", + "version": "1.0.0-beta.14", "private": true, "scripts": { "dev": "astro dev", diff --git a/src/components/blog/ListItem.astro b/src/components/blog/ListItem.astro index c4f6c7c..dff647f 100644 --- a/src/components/blog/ListItem.astro +++ b/src/components/blog/ListItem.astro @@ -49,6 +49,16 @@ const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : + { + post.author && ( + <> + {' '} + ·{' '} + + {post.author.replaceAll('-', ' ')} + + ) + } { post.category && ( <> @@ -60,14 +70,7 @@ const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') : ) } - { - post.author && ( - <> - {' '} - · {post.author.replaceAll('-', ' ')} - - ) - } +

diff --git a/src/components/blog/SinglePost.astro b/src/components/blog/SinglePost.astro index a2169c1..966c89f 100644 --- a/src/components/blog/SinglePost.astro +++ b/src/components/blog/SinglePost.astro @@ -26,6 +26,15 @@ const { Content } = post;

+ { + post.author && ( + <> + {' '} + ·{' '} + {post.author} + + ) + } { post.category && ( <> @@ -40,16 +49,7 @@ const { Content } = post; {post.readingTime && <> · {post.readingTime} min read}

- { - post.author && ( -
-

- - {post.author} -

-
- ) - } +

@@ -84,13 +84,7 @@ const { Content } = post;
- { - Content ? ( - - ) : ( - - ) - } + {Content ? : }
diff --git a/src/config.yaml b/src/config.yaml index e25340b..8f4c1de 100644 --- a/src/config.yaml +++ b/src/config.yaml @@ -35,8 +35,6 @@ apps: blog: isEnabled: true postsPerPage: 6 - isRelatedPostsEnabled: true - relatedPostsCount: 4 post: isEnabled: true @@ -62,6 +60,9 @@ apps: robots: index: false + isRelatedPostsEnabled: true + relatedPostsCount: 4 + analytics: vendors: googleAnalytics: diff --git a/src/utils/config.ts b/src/utils/config.ts index 6e2a2e7..5bd2cc9 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -138,6 +138,8 @@ const getAppBlog = () => { const _default = { isEnabled: false, postsPerPage: 6, + isRelatedPostsEnabled: false, + relatedPostsCount: 4, post: { isEnabled: true, permalink: '/blog/%slug%',