Simplify folders and more typescript migration
This commit is contained in:
@ -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, '');
|
||||
};
|
||||
|
@ -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 => {
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user