Small adjustments associated with Relative Posts

This commit is contained in:
prototypa
2024-01-21 21:35:25 -05:00
parent 964d4da878
commit 106cd931f0
7 changed files with 40 additions and 32 deletions

View File

@ -128,6 +128,12 @@
"postsPerPage": { "postsPerPage": {
"type": "integer" "type": "integer"
}, },
"isRelatedPostsEnabled": {
"type": "boolean"
},
"relatedPostsCount": {
"type": "integer"
},
"post": { "post": {
"type": "object", "type": "object",
"properties": { "properties": {

View File

@ -119,7 +119,6 @@ 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. 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! > 🧑‍🚀 **Seasoned astronaut?** Delete this file `README.md`. Update `src/config.yaml` and contents. Have fun!
@ -182,8 +181,8 @@ i18n:
apps: apps:
blog: blog:
isEnabled: true isEnabled: true # If the blog will be enabled
postsPerPage: 6 postsPerPage: 6 # Number of posts per page
post: post:
isEnabled: true isEnabled: true
@ -209,6 +208,9 @@ apps:
robots: robots:
index: false 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: analytics:
vendors: vendors:
googleAnalytics: googleAnalytics:

View File

@ -1,7 +1,7 @@
{ {
"name": "@onwidget/astrowind", "name": "@onwidget/astrowind",
"description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.", "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, "private": true,
"scripts": { "scripts": {
"dev": "astro dev", "dev": "astro dev",

View File

@ -49,6 +49,16 @@ const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') :
<span class="text-sm"> <span class="text-sm">
<Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
<time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time> <time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time>
{
post.author && (
<>
{' '}
·{' '}
<Icon name="tabler:user" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
<span>{post.author.replaceAll('-', ' ')}</span>
</>
)
}
{ {
post.category && ( post.category && (
<> <>
@ -60,14 +70,7 @@ const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') :
</> </>
) )
} }
{
post.author && (
<>
{' '}
· <span>{post.author.replaceAll('-', ' ')}</span>
</>
)
}
</span> </span>
</div> </div>
<h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300"> <h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300">

View File

@ -26,6 +26,15 @@ const { Content } = post;
<p> <p>
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" /> <Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
<time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time> <time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time>
{
post.author && (
<>
{' '}
·{' '}<Icon name="tabler:user" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
<span class="inline-block">{post.author}</span>
</>
)
}
{ {
post.category && ( post.category && (
<> <>
@ -40,16 +49,7 @@ const { Content } = post;
{post.readingTime && <> · {post.readingTime} min read</>} {post.readingTime && <> · {post.readingTime} min read</>}
</p> </p>
</div> </div>
{
post.author && (
<div class="flex justify-between flex-col sm:flex-row max-w-3xl mx-auto mt-0 mb-2 px-4 sm:px-6 sm:items-center">
<p>
<Icon name="tabler:user" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
{post.author}
</p>
</div>
)
}
<h1 <h1
class="px-4 sm:px-6 max-w-3xl mx-auto text-4xl md:text-5xl font-bold leading-tighter tracking-tighter font-heading" class="px-4 sm:px-6 max-w-3xl mx-auto text-4xl md:text-5xl font-bold leading-tighter tracking-tighter font-heading"
> >
@ -84,13 +84,7 @@ const { Content } = post;
<div <div
class="mx-auto px-6 sm:px-6 max-w-3xl prose prose-lg lg:prose-xl dark:prose-invert dark:prose-headings:text-slate-300 prose-md prose-headings:font-heading prose-headings:leading-tighter prose-headings:tracking-tighter prose-headings:font-bold prose-a:text-primary dark:prose-a:text-blue-400 prose-img:rounded-md prose-img:shadow-lg mt-8 prose-headings:scroll-mt-[80px]" class="mx-auto px-6 sm:px-6 max-w-3xl prose prose-lg lg:prose-xl dark:prose-invert dark:prose-headings:text-slate-300 prose-md prose-headings:font-heading prose-headings:leading-tighter prose-headings:tracking-tighter prose-headings:font-bold prose-a:text-primary dark:prose-a:text-blue-400 prose-img:rounded-md prose-img:shadow-lg mt-8 prose-headings:scroll-mt-[80px]"
> >
{ {Content ? <Content /> : <Fragment set:html={post.content || ''} />}
Content ? (
<Content />
) : (
<Fragment set:html={post.content || ""} />
)
}
</div> </div>
<div class="mx-auto px-6 sm:px-6 max-w-3xl mt-8 flex justify-between flex-col sm:flex-row"> <div class="mx-auto px-6 sm:px-6 max-w-3xl mt-8 flex justify-between flex-col sm:flex-row">
<PostTags tags={post.tags} class="mr-5 rtl:mr-0 rtl:ml-5" /> <PostTags tags={post.tags} class="mr-5 rtl:mr-0 rtl:ml-5" />

View File

@ -35,8 +35,6 @@ apps:
blog: blog:
isEnabled: true isEnabled: true
postsPerPage: 6 postsPerPage: 6
isRelatedPostsEnabled: true
relatedPostsCount: 4
post: post:
isEnabled: true isEnabled: true
@ -62,6 +60,9 @@ apps:
robots: robots:
index: false index: false
isRelatedPostsEnabled: true
relatedPostsCount: 4
analytics: analytics:
vendors: vendors:
googleAnalytics: googleAnalytics:

View File

@ -138,6 +138,8 @@ const getAppBlog = () => {
const _default = { const _default = {
isEnabled: false, isEnabled: false,
postsPerPage: 6, postsPerPage: 6,
isRelatedPostsEnabled: false,
relatedPostsCount: 4,
post: { post: {
isEnabled: true, isEnabled: true,
permalink: '/blog/%slug%', permalink: '/blog/%slug%',