Allow post permalink pattern configuration

This commit is contained in:
prototypa
2023-01-24 00:22:13 -05:00
parent ddeac0576f
commit 47948c3da3
7 changed files with 68 additions and 35 deletions

View File

@ -5,7 +5,7 @@ import Layout from '~/layouts/PageLayout.astro';
import SinglePost from '~/components/blog/SinglePost.astro';
import ToBlogLink from '~/components/blog/ToBlogLink.astro';
import { getCanonical, getPermalink, POST_BASE } from '~/utils/permalinks';
import { getCanonical, getPermalink } from '~/utils/permalinks';
import { fetchPosts } from '~/utils/blog';
import { findImage } from '~/utils/images';
@ -13,20 +13,19 @@ export async function getStaticPaths() {
if (BLOG?.disabled || BLOG?.post?.disabled) return [];
return (await fetchPosts()).map((post) => ({
params: {
slug: post.slug,
blog: POST_BASE || undefined,
blog: post.permalink,
},
props: { post },
}));
}
const { post } = Astro.props;
const url = getCanonical(getPermalink(post.slug, 'post'));
const url = getCanonical(getPermalink(post.permalink, 'post'));
const meta = {
title: post.title,
description: post.description,
canonical: post.canonical || undefined,
canonical: post.canonical || url,
image: await findImage(post.image),
noindex: BLOG?.post?.noindex,
ogType: 'article',