Simplify folders and more typescript migration

This commit is contained in:
prototypa
2023-01-03 22:52:10 -05:00
parent 6777af58f3
commit 046009ec8c
37 changed files with 114 additions and 108 deletions

View File

@ -13,6 +13,6 @@ export const getProjectRootDir = (): string => {
const __srcFolder = path.join(getProjectRootDir(), '/src');
/** */
export const getRelativeUrlByFilePath = (filepath: string): string | URL => {
export const getRelativeUrlByFilePath = (filepath: string): string => {
return filepath.replace(__srcFolder, '');
};

View File

@ -26,7 +26,7 @@ export const CATEGORY_BASE = cleanSlug(BLOG?.category?.pathname);
export const TAG_BASE = cleanSlug(BLOG?.tag?.pathname);
/** */
export const getCanonical = (path = '') => new URL(path, SITE.origin);
export const getCanonical = (path = ''): string | URL => new URL(path, SITE.origin);
/** */
export const getPermalink = (slug = '', type = 'page'): string => {

View File

@ -1,6 +1,6 @@
import { getCollection, getEntry } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
import type { Post } from "~/types"
import type { Post } from '~/types';
const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise<Post> => {
const { id, slug, data } = post;