diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-25 15:33:27 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-25 15:38:50 +0100 |
| commit | 97dc68e22e754d8e478beee590dbe9868171af50 (patch) | |
| tree | 01876f9b236b0a4ba696d5b084bd766b69046494 /src/ts | |
| parent | 71942c86311a9d1ddf4ae486d811f8393786e855 (diff) | |
chore: add reading time in posts meta
Diffstat (limited to 'src/ts')
| -rw-r--r-- | src/ts/types/app.ts | 6 | ||||
| -rw-r--r-- | src/ts/types/articles.ts | 18 | ||||
| -rw-r--r-- | src/ts/types/taxonomies.ts | 8 |
3 files changed, 26 insertions, 6 deletions
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts index a58f710..ddd64d1 100644 --- a/src/ts/types/app.ts +++ b/src/ts/types/app.ts @@ -61,6 +61,11 @@ export type ButtonKind = 'primary' | 'secondary' | 'tertiary'; export type ButtonPosition = 'left' | 'right' | 'center'; +export type ContentInfo = { + readingTime: number; + wordsCount: number; +}; + export type ContentParts = { afterMore: string; beforeMore: string; @@ -110,6 +115,7 @@ export type Project = { intro: string; meta: ProjectMeta; slug: string; + tagline?: string; title: string; seo: { title: string; diff --git a/src/ts/types/articles.ts b/src/ts/types/articles.ts index 88b79dd..5281e7e 100644 --- a/src/ts/types/articles.ts +++ b/src/ts/types/articles.ts @@ -1,4 +1,4 @@ -import { ContentParts, Dates } from './app'; +import { ContentInfo, ContentParts, Dates } from './app'; import { Comment, CommentsNode } from './comments'; import { Cover, RawCover } from './cover'; import { SEO } from './seo'; @@ -24,10 +24,12 @@ export type ArticleMeta = { author?: ArticleAuthor; commentCount?: number; dates?: Dates; + readingTime?: number; results?: number; topics?: TopicPreview[]; thematics?: ThematicPreview[]; website?: string; + wordsCount?: number; }; export type Article = { @@ -39,6 +41,7 @@ export type Article = { dates: Dates; featuredImage: Cover; id: string; + info: ContentInfo; intro: string; seo: SEO; topics: TopicPreview[] | []; @@ -48,7 +51,7 @@ export type Article = { export type RawArticle = Pick< Article, - 'commentCount' | 'databaseId' | 'id' | 'seo' | 'title' + 'commentCount' | 'databaseId' | 'id' | 'info' | 'seo' | 'title' > & { acfPosts: RawACFPosts; author: { node: ArticleAuthor }; @@ -61,12 +64,19 @@ export type RawArticle = Pick< export type ArticlePreview = Pick< Article, - 'commentCount' | 'dates' | 'id' | 'intro' | 'topics' | 'thematics' | 'title' + | 'commentCount' + | 'dates' + | 'id' + | 'info' + | 'intro' + | 'topics' + | 'thematics' + | 'title' > & { featuredImage: Cover; slug: string }; export type RawArticlePreview = Pick< Article, - 'commentCount' | 'id' | 'title' + 'commentCount' | 'id' | 'info' | 'title' > & { acfPosts: ACFPosts; contentParts: Pick<ContentParts, 'beforeMore'>; diff --git a/src/ts/types/taxonomies.ts b/src/ts/types/taxonomies.ts index 7d4ad3b..a62bef4 100644 --- a/src/ts/types/taxonomies.ts +++ b/src/ts/types/taxonomies.ts @@ -1,4 +1,4 @@ -import { ContentParts, Dates, Slug } from './app'; +import { ContentInfo, ContentParts, Dates, Slug } from './app'; import { ArticlePreview, RawArticlePreview } from './articles'; import { Cover, RawCover } from './cover'; import { SEO } from './seo'; @@ -12,13 +12,17 @@ type Taxonomy = { databaseId: number; dates: Dates; id: string; + info: ContentInfo; intro: string; posts: ArticlePreview[]; seo: SEO; title: string; }; -type TaxonomyPreview = Pick<Taxonomy, 'databaseId' | 'id' | 'seo' | 'title'> & { +type TaxonomyPreview = Pick< + Taxonomy, + 'databaseId' | 'id' | 'info' | 'seo' | 'title' +> & { slug: string; }; |
