Skip to content

Commit 106cd93

Browse files
committed
Small adjustments associated with Relative Posts
1 parent 964d4da commit 106cd93

File tree

7 files changed

+38
-30
lines changed

7 files changed

+38
-30
lines changed

.vscode/astrowind/config-schema.json

+6
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@
128128
"postsPerPage": {
129129
"type": "integer"
130130
},
131+
"isRelatedPostsEnabled": {
132+
"type": "boolean"
133+
},
134+
"relatedPostsCount": {
135+
"type": "integer"
136+
},
131137
"post": {
132138
"type": "object",
133139
"properties": {

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ There's nothing special about `src/components/`, but that's where we like to put
119119

120120
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.
121121

122-
123-
[![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)
122+
[![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)
124123

125124
> 🧑‍🚀 **Seasoned astronaut?** Delete this file `README.md`. Update `src/config.yaml` and contents. Have fun!
126125
@@ -182,8 +181,8 @@ i18n:
182181

183182
apps:
184183
blog:
185-
isEnabled: true
186-
postsPerPage: 6
184+
isEnabled: true # If the blog will be enabled
185+
postsPerPage: 6 # Number of posts per page
187186

188187
post:
189188
isEnabled: true
@@ -209,6 +208,9 @@ apps:
209208
robots:
210209
index: false
211210

211+
isRelatedPostsEnabled: true # If a widget with related posts is to be displayed below each post
212+
relatedPostsCount: 4 # Number of related posts to display
213+
212214
analytics:
213215
vendors:
214216
googleAnalytics:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@onwidget/astrowind",
33
"description": "AstroWind: A free template using Astro 4.0 and Tailwind CSS. Astro starter theme.",
4-
"version": "1.0.0-beta.13",
4+
"version": "1.0.0-beta.14",
55
"private": true,
66
"scripts": {
77
"dev": "astro dev",

src/components/blog/ListItem.astro

+9-6
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,27 @@ const link = APP_BLOG?.post?.isEnabled ? getPermalink(post.permalink, 'post') :
5050
<Icon name="tabler:clock" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
5151
<time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time>
5252
{
53-
post.category && (
53+
post.author && (
5454
<>
5555
{' '}
5656
·{' '}
57-
<a class="capitalize hover:underline" href={getPermalink(post.category, 'category')}>
58-
{post.category.replaceAll('-', ' ')}
59-
</a>
57+
<Icon name="tabler:user" class="w-3.5 h-3.5 inline-block -mt-0.5 dark:text-gray-400" />
58+
<span>{post.author.replaceAll('-', ' ')}</span>
6059
</>
6160
)
6261
}
6362
{
64-
post.author && (
63+
post.category && (
6564
<>
6665
{' '}
67-
· <span>{post.author.replaceAll('-', ' ')}</span>
66+
·{' '}
67+
<a class="capitalize hover:underline" href={getPermalink(post.category, 'category')}>
68+
{post.category.replaceAll('-', ' ')}
69+
</a>
6870
</>
6971
)
7072
}
73+
7174
</span>
7275
</div>
7376
<h2 class="text-xl sm:text-2xl font-bold leading-tight mb-2 font-heading dark:text-slate-300">

src/components/blog/SinglePost.astro

+11-17
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ const { Content } = post;
2626
<p>
2727
<Icon name="tabler:clock" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
2828
<time datetime={String(post.publishDate)} class="inline-block">{getFormattedDate(post.publishDate)}</time>
29+
{
30+
post.author && (
31+
<>
32+
{' '}
33+
·{' '}<Icon name="tabler:user" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
34+
<span class="inline-block">{post.author}</span>
35+
</>
36+
)
37+
}
2938
{
3039
post.category && (
3140
<>
@@ -40,16 +49,7 @@ const { Content } = post;
4049
{post.readingTime && <> · {post.readingTime} min read</>}
4150
</p>
4251
</div>
43-
{
44-
post.author && (
45-
<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">
46-
<p>
47-
<Icon name="tabler:user" class="w-4 h-4 inline-block -mt-0.5 dark:text-gray-400" />
48-
{post.author}
49-
</p>
50-
</div>
51-
)
52-
}
52+
5353
<h1
5454
class="px-4 sm:px-6 max-w-3xl mx-auto text-4xl md:text-5xl font-bold leading-tighter tracking-tighter font-heading"
5555
>
@@ -84,13 +84,7 @@ const { Content } = post;
8484
<div
8585
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]"
8686
>
87-
{
88-
Content ? (
89-
<Content />
90-
) : (
91-
<Fragment set:html={post.content || ""} />
92-
)
93-
}
87+
{Content ? <Content /> : <Fragment set:html={post.content || ''} />}
9488
</div>
9589
<div class="mx-auto px-6 sm:px-6 max-w-3xl mt-8 flex justify-between flex-col sm:flex-row">
9690
<PostTags tags={post.tags} class="mr-5 rtl:mr-0 rtl:ml-5" />

src/config.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ apps:
3535
blog:
3636
isEnabled: true
3737
postsPerPage: 6
38-
isRelatedPostsEnabled: true
39-
relatedPostsCount: 4
4038

4139
post:
4240
isEnabled: true
@@ -62,6 +60,9 @@ apps:
6260
robots:
6361
index: false
6462

63+
isRelatedPostsEnabled: true
64+
relatedPostsCount: 4
65+
6566
analytics:
6667
vendors:
6768
googleAnalytics:

src/utils/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ const getAppBlog = () => {
138138
const _default = {
139139
isEnabled: false,
140140
postsPerPage: 6,
141+
isRelatedPostsEnabled: false,
142+
relatedPostsCount: 4,
141143
post: {
142144
isEnabled: true,
143145
permalink: '/blog/%slug%',

0 commit comments

Comments
 (0)