diff --git a/src/components/atoms/Pagination.astro b/src/components/atoms/Pagination.astro index 71cb7ea..6ab5fa6 100644 --- a/src/components/atoms/Pagination.astro +++ b/src/components/atoms/Pagination.astro @@ -16,11 +16,7 @@ const { prevUrl, nextUrl, prevText = 'Newer posts', nextText = 'Older posts' } = (prevUrl || nextUrl) && (
- +

{prevText}

diff --git a/src/components/atoms/Tags.astro b/src/components/atoms/Tags.astro index 03728a7..54b95e1 100644 --- a/src/components/atoms/Tags.astro +++ b/src/components/atoms/Tags.astro @@ -1,7 +1,7 @@ --- import { getPermalink } from '~/utils/permalinks'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { tags: Post['tags']; diff --git a/src/components/blog/Grid.astro b/src/components/blog/Grid.astro index 95ad4d1..291073d 100644 --- a/src/components/blog/Grid.astro +++ b/src/components/blog/Grid.astro @@ -1,6 +1,6 @@ --- import Item from '~/components/blog/GridItem.astro'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { posts: Array; diff --git a/src/components/blog/GridItem.astro b/src/components/blog/GridItem.astro index aa90c2b..311b7bc 100644 --- a/src/components/blog/GridItem.astro +++ b/src/components/blog/GridItem.astro @@ -4,7 +4,7 @@ import { Picture } from '@astrojs/image/components'; import { findImage } from '~/utils/images'; import { getPermalink } from '~/utils/permalinks'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { post: Post; diff --git a/src/components/blog/List.astro b/src/components/blog/List.astro index cc815e4..741e4cf 100644 --- a/src/components/blog/List.astro +++ b/src/components/blog/List.astro @@ -1,6 +1,6 @@ --- import Item from '~/components/blog/ListItem.astro'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { posts: Array; diff --git a/src/components/blog/ListItem.astro b/src/components/blog/ListItem.astro index 830ce91..8333abe 100644 --- a/src/components/blog/ListItem.astro +++ b/src/components/blog/ListItem.astro @@ -6,7 +6,7 @@ import { getPermalink } from '~/utils/permalinks'; import { findImage } from '~/utils/images'; import { getFormattedDate } from '~/utils/utils'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { post: Post; diff --git a/src/components/blog/SinglePost.astro b/src/components/blog/SinglePost.astro index 6d3a953..21f3c84 100644 --- a/src/components/blog/SinglePost.astro +++ b/src/components/blog/SinglePost.astro @@ -5,7 +5,7 @@ import SocialShare from '~/components/atoms/SocialShare.astro'; import { getFormattedDate } from '~/utils/utils'; -import type { Post } from '~/utils/posts'; +import type { Post } from "~/types" export interface Props { post: Post; diff --git a/src/components/core/MetaTags.astro b/src/components/core/MetaTags.astro index 378bdf2..49f7405 100644 --- a/src/components/core/MetaTags.astro +++ b/src/components/core/MetaTags.astro @@ -11,6 +11,8 @@ import Fonts from '../atoms/Fonts.astro'; import ExtraMetaTags from '../atoms/ExtraMetaTags.astro'; import SplitbeeAnalytics from './SplitbeeAnalytics.astro'; +import { MetaSEO } from '~/types'; + const { src: defaultImage } = await getImage({ src: defaultImageSrc, alt: 'Default image', @@ -18,6 +20,8 @@ const { src: defaultImage } = await getImage({ height: 628, }); +export interface Props extends MetaSEO {} + const { title = SITE.name, description = '', diff --git a/src/env.d.ts b/src/env.d.ts index f964fe0..dc790a8 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1 +1 @@ -/// +/// \ No newline at end of file diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index a563c08..ed65397 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -4,6 +4,12 @@ import '~/assets/styles/base.css'; import MetaTags from '~/components/core/MetaTags.astro'; import BasicScripts from '~/components/core/BasicScripts.astro'; +import { MetaSEO } from '~/types'; + +export interface Props { + meta?: MetaSEO; +} + const { meta = {} } = Astro.props; --- diff --git a/src/layouts/BlogLayout.astro b/src/layouts/BlogLayout.astro index 93f1911..83a8919 100644 --- a/src/layouts/BlogLayout.astro +++ b/src/layouts/BlogLayout.astro @@ -1,6 +1,12 @@ --- import Layout from '~/layouts/PageLayout.astro'; +import { MetaSEO } from '~/types'; + +export interface Props { + meta?: MetaSEO; +} + const { meta } = Astro.props; --- diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro index 8c8999d..afa7269 100644 --- a/src/layouts/PageLayout.astro +++ b/src/layouts/PageLayout.astro @@ -4,6 +4,12 @@ import Header from '~/components/widgets/Header.astro'; import Footer from '~/components/widgets/Footer.astro'; import Announcement from '~/components/widgets/Announcement.astro'; +import { MetaSEO } from '~/types'; + +export interface Props { + meta?: MetaSEO; +} + const { meta } = Astro.props; --- diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..4ef6ef3 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,37 @@ +export interface Post { + id: string; + slug: string; + + publishDate: Date; + title: string; + description?: string; + + image?: string; + + canonical?: string | URL; + permalink?: string; + + draft?: boolean; + + excerpt?: string; + category?: string; + tags?: Array; + authors?: Array; + + Content: unknown; + content?: string; + readingTime: number; +} + +export interface MetaSEO { + title?: string, + description?: string, + image?: string, + + canonical?: string, + noindex?: boolean, + nofollow?: boolean, + + ogTitle?: string, + ogType?: string, +} \ No newline at end of file diff --git a/src/utils/posts.ts b/src/utils/posts.ts index 3f15fa5..5638b5d 100644 --- a/src/utils/posts.ts +++ b/src/utils/posts.ts @@ -1,30 +1,6 @@ import { getCollection, getEntry } from 'astro:content'; import type { CollectionEntry } from 'astro:content'; - -export interface Post { - id: string; - slug: string; - - publishDate: Date; - title: string; - description?: string; - - image?: string; - - canonical?: string; - permalink?: string; - - draft?: boolean; - - excerpt?: string; - category?: string; - tags?: Array; - authors?: Array; - - Content: unknown; - content?: string; - readingTime: number; -} +import type { Post } from "~/types" const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise => { const { id, slug, data } = post;