1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-28 16:48:00 +02:00
This commit is contained in:
Matthias Kretschmann 2023-09-23 20:13:53 +01:00
parent 446cef9e0a
commit 7746ce4a28
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 6 additions and 6 deletions

View File

@ -13,7 +13,7 @@ if (!repoInfo) {
console.info(`Repo ${repo} not found`) console.info(`Repo ${repo} not found`)
return return
} }
const { url, owner, object } = repoInfo const { url, object } = repoInfo
const changelogHtml = await markdownToHtml( const changelogHtml = await markdownToHtml(
object.text.replace('### Changelog', '') object.text.replace('### Changelog', '')
) )
@ -27,7 +27,7 @@ const changelogHtml = await markdownToHtml(
<p class={styles.source}> <p class={styles.source}>
sourced from{' '} sourced from{' '}
<a href={`${url}/tree/main/CHANGELOG.md`}> <a href={`${url}/tree/main/CHANGELOG.md`}>
<code>{`${owner?.login}/${repo}:CHANGELOG.md`}</code> <code>{`${repo}:CHANGELOG.md`}</code>
</a> </a>
</p> </p>
<div class={styles.content} set:html={changelogHtml} /> <div class={styles.content} set:html={changelogHtml} />

View File

@ -1,10 +1,10 @@
import { type CollectionEntry } from 'astro:content' import { type CollectionEntry } from 'astro:content'
import { getAllPosts } from './index' import { getAllPosts } from './getAllPosts'
// helps to reduce DOM size // helps to reduce DOM size
export async function getAllPostsForSearch() { export async function getAllPostsForSearch() {
const allPosts = await getAllPosts() const allPosts = await getAllPosts()
if (!allPosts) return if (!allPosts) return []
const cleaned = await Promise.all( const cleaned = await Promise.all(
allPosts.map(async (post) => { allPosts.map(async (post) => {

View File

@ -7,7 +7,7 @@ export function getSlug(filePath: string) {
// construct slug as full path from either file or folder name, // construct slug as full path from either file or folder name,
if (parsedPath.base === 'index.md') { if (parsedPath.base === 'index.md') {
slug = `${parsedPath.dir}` slug = parsedPath.dir
} else { } else {
slug = `${parsedPath.dir}/${parsedPath.name}` slug = `${parsedPath.dir}/${parsedPath.name}`
} }

View File

@ -32,7 +32,7 @@ export async function loadAndFormatCollection(
// //
// construct slug from folder or file name // construct slug from folder or file name
// //
const slug = getSlug(post.id) const slug = getSlug(`${post.collection}/${post.id}`)
const githubLink = `${config.repoContentPath}/${post.collection}/${post.id}` const githubLink = `${config.repoContentPath}/${post.collection}/${post.id}`