mirror of
https://github.com/lbr77/blog-astro.git
synced 2026-04-10 09:39:11 +00:00
customize more
This commit is contained in:
@@ -14,10 +14,8 @@ import Layout from '@/layouts/Layout.astro'
|
||||
import {
|
||||
getAdjacentPosts,
|
||||
getAllPostsAndSubposts,
|
||||
getCombinedReadingTime,
|
||||
getParentId,
|
||||
getParentPost,
|
||||
getPostReadingTime,
|
||||
getSubpostCount,
|
||||
getTOCSections,
|
||||
fetchRemotePostContent,
|
||||
@@ -27,7 +25,7 @@ import {
|
||||
parseAuthors,
|
||||
} from '@/lib/data-utils'
|
||||
import type { TOCSection } from '@/lib/data-utils'
|
||||
import { formatDate, readingTime } from '@/lib/utils'
|
||||
import { formatDate } from '@/lib/utils'
|
||||
import { Icon } from 'astro-icon/components'
|
||||
import { Image } from 'astro:assets'
|
||||
import { render } from 'astro:content'
|
||||
@@ -68,13 +66,6 @@ const hasChildPosts = await hasSubposts(currentPostId)
|
||||
const subpostCount = !isCurrentSubpost
|
||||
? await getSubpostCount(currentPostId)
|
||||
: 0
|
||||
const postReadingTime = remoteContent
|
||||
? readingTime(remoteContent.wordCount)
|
||||
: await getPostReadingTime(currentPostId)
|
||||
const combinedReadingTime =
|
||||
!remoteContent && hasChildPosts && !isCurrentSubpost
|
||||
? await getCombinedReadingTime(currentPostId)
|
||||
: null
|
||||
|
||||
const tocSections: TOCSection[] = remoteContent
|
||||
? remoteContent.headings.length > 0
|
||||
@@ -87,12 +78,8 @@ const tocSections: TOCSection[] = remoteContent
|
||||
]
|
||||
: []
|
||||
: await getTOCSections(currentPostId)
|
||||
const heroImage =
|
||||
post.data.banner && typeof post.data.banner === 'object' && 'src' in post.data.banner
|
||||
? post.data.banner
|
||||
: post.data.image && typeof post.data.image === 'object' && 'src' in post.data.image
|
||||
? post.data.image
|
||||
: null
|
||||
const heroImage = post.data.banner
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<Layout>
|
||||
@@ -204,23 +191,6 @@ const heroImage =
|
||||
<span>{formatDate(post.data.date)}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="flex w-full items-center justify-center gap-2 py-2 sm:w-fit sm:px-2 sm:py-0 first:sm:pl-0 last:sm:pr-0"
|
||||
>
|
||||
<span>
|
||||
{postReadingTime}
|
||||
{
|
||||
combinedReadingTime &&
|
||||
combinedReadingTime !== postReadingTime && (
|
||||
<span class="text-muted-foreground">
|
||||
{' '}
|
||||
({combinedReadingTime} total)
|
||||
</span>
|
||||
)
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{
|
||||
subpostCount > 0 && (
|
||||
<div class="flex w-full items-center justify-center gap-1 py-2 sm:w-fit sm:px-2 sm:py-0 first:sm:pl-0 last:sm:pr-0">
|
||||
|
||||
@@ -21,6 +21,7 @@ const { page } = Astro.props
|
||||
|
||||
const postsByYear = groupPostsByYear(page.data)
|
||||
const years = Object.keys(postsByYear).sort((a, b) => parseInt(b) - parseInt(a))
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<Layout class="max-w-3xl">
|
||||
|
||||
@@ -24,6 +24,7 @@ export async function getStaticPaths() {
|
||||
}
|
||||
|
||||
const { tag, posts } = Astro.props
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<Layout class="max-w-3xl">
|
||||
|
||||
@@ -8,6 +8,7 @@ import { getSortedTags } from '@/lib/data-utils'
|
||||
import { Icon } from 'astro-icon/components'
|
||||
|
||||
const sortedTags = await getSortedTags()
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<Layout class="max-w-3xl">
|
||||
|
||||
Reference in New Issue
Block a user