mirror of
https://github.com/kremalicious/blog.git
synced 2024-06-28 08:37:57 +02:00
githubLink solution
This commit is contained in:
parent
610dbde823
commit
9984105cc1
|
@ -24,7 +24,7 @@ const schemaShared = {
|
|||
featured: z.boolean().optional(),
|
||||
style: z.string().optional(),
|
||||
toc: z.boolean().optional(),
|
||||
slug: z.string().optional()
|
||||
githubLink: z.string().optional()
|
||||
}
|
||||
|
||||
export const schemaArticles = (image: ImageFunction) =>
|
||||
|
|
|
@ -4,7 +4,11 @@ import styles from './Actions.module.css'
|
|||
import Action from './Action.astro'
|
||||
import { Mastodon, Bitcoin, Github } from '@images/icons'
|
||||
|
||||
const githubLink = '?'
|
||||
type Props = {
|
||||
githubLink: string
|
||||
}
|
||||
|
||||
const { githubLink } = Astro.props
|
||||
|
||||
const actions = [
|
||||
{
|
||||
|
|
|
@ -14,7 +14,7 @@ type Props = CollectionEntry<'articles' | 'links' | 'photos'> & {
|
|||
}
|
||||
|
||||
const { data, collection, lead, tableOfContents } = Astro.props
|
||||
const { title, date, updated, image, linkurl, toc, style } = data
|
||||
const { title, date, updated, image, linkurl, toc, style, githubLink } = data
|
||||
---
|
||||
|
||||
<LayoutBase title={title} style={style}>
|
||||
|
@ -46,7 +46,7 @@ const { title, date, updated, image, linkurl, toc, style } = data
|
|||
<slot />
|
||||
|
||||
<Meta post={Astro.props} />
|
||||
{collection !== 'photos' && <Actions />}
|
||||
{collection !== 'photos' && <Actions githubLink={githubLink as string} />}
|
||||
|
||||
{
|
||||
/* <RelatedPosts isPhotos={collection === 'photos'} tags={tags as string[]} /> */
|
||||
|
|
|
@ -36,9 +36,11 @@ export async function loadAndFormatCollection(
|
|||
|
||||
// use date from frontmatter, or grab from file path
|
||||
const date = post.data.date ? post.data.date : slug.substring(1, 11)
|
||||
const githubLink = `https://github.com/kremalicious/blog/blob/main/content/${post.collection}/${post.id}`
|
||||
|
||||
post.slug = slug
|
||||
post.data.date = new Date(date)
|
||||
post.data.githubLink = githubLink
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user