import { IS_BROWSER } from '../../configs' import { ImageCMSItemProps } from './image' export interface BlogCategoryProps { id: number attributes: { name: string slug: string } } export interface BlogItemProps { id: number attributes: { title: string slug: string content: string readingTime: string publishedAt: string coverImage: ImageCMSItemProps category: { data: BlogCategoryProps } } } export const getBlogUrl = (slug) => { if (IS_BROWSER) { const currentUrl = window?.location?.href const urlSlitArr = currentUrl.split('/') urlSlitArr.pop() return `${urlSlitArr.join('/')}/blog/${slug}` } return '/' }