From 5b762b1b669454a89899c4bdf6008027d9615acf Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 30 Nov 2023 19:30:43 +0100 Subject: refactor(pages): refine Article pages * use rehype to update code blocks class names * fix widget heading level (after a level 1 it should always be a level 2 and not 3) * replace Spinner with LoadingPage and LoadingPageComments components to keep layout coherent * refactor useArticle and useComments hooks * fix URLs in JSON LD schema * add Cypress tests --- src/services/graphql/helpers/convert-post-to-article.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/services/graphql/helpers/convert-post-to-article.ts') diff --git a/src/services/graphql/helpers/convert-post-to-article.ts b/src/services/graphql/helpers/convert-post-to-article.ts index 383dc47..14c572d 100644 --- a/src/services/graphql/helpers/convert-post-to-article.ts +++ b/src/services/graphql/helpers/convert-post-to-article.ts @@ -1,4 +1,5 @@ import type { Article, WPPost } from '../../../types'; +import { ROUTES } from '../../../utils/constants'; import { updateContentTree } from '../../../utils/helpers'; import { convertWPThematicPreviewToPageLink, @@ -6,7 +7,7 @@ import { } from './convert-taxonomy-to-page-link'; import { convertWPImgToImg } from './convert-wp-image-to-img'; -export const convertPostToArticle = async ({ +export const convertPostToArticle = ({ acfPosts, author, commentCount, @@ -19,9 +20,9 @@ export const convertPostToArticle = async ({ seo, slug, title, -}: WPPost): Promise
=> { +}: WPPost): Article => { return { - content: await updateContentTree(contentParts.afterMore), + content: updateContentTree(contentParts.afterMore), id: databaseId, intro: contentParts.beforeMore, meta: { @@ -42,7 +43,7 @@ export const convertPostToArticle = async ({ topics: acfPosts?.postsInTopic?.map(convertWPTopicPreviewToPageLink), wordsCount: info.wordsCount, }, - slug, + slug: `${ROUTES.ARTICLE}/${slug}`, title, }; }; -- cgit v1.2.3