Skip to content

Commit

Permalink
Merge pull request #517 from Mile-Writings/feat/#500/dynamicOGImage
Browse files Browse the repository at this point in the history
[ Feat/#500 ] prerender 파이프라인 구축 후 글 페이지에 대한 dynamic og meta tag 추가
  • Loading branch information
moondda authored Dec 26, 2024
2 parents 799eb82 + 3e67d46 commit da800a7
Show file tree
Hide file tree
Showing 7 changed files with 135 additions and 440 deletions.
284 changes: 0 additions & 284 deletions public/mockServiceWorker.js

This file was deleted.

1 change: 0 additions & 1 deletion public/vite.svg

This file was deleted.

27 changes: 0 additions & 27 deletions src/pages/postDetail/PostDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import styled from '@emotion/styled';
import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';

import { Helmet } from 'react-helmet-async';
import { useParams } from 'react-router-dom';
import { DefaultModal, DefaultModalBtn } from '../../components/commons/modal/DefaultModal';
import Responsive from '../../components/commons/Responsive/Responsive';
Expand Down Expand Up @@ -108,32 +107,6 @@ const PostDetail = () => {

return (
<>
<Helmet>
<title>{`MILE - ${postData?.title}`}</title>
<meta property="og:title" content={postData?.title} />
<meta
property="og:description"
content={
// '오직 글쓰기 모임을 위한 블로그, 마일에서 모임원들과 함께 글을 쓰며 여러분 만의 공간을 만들어보세요'
'test'
}
></meta>
<meta property="og:image" content={postData?.imageUrl} />
<meta name="keyword" content={`글쓰기, 글, 글모임, mile, MILE, 마일, ${postData?.title}`} />
<meta
property="og:url"
content={`https://www.milewriting.com/detail/${groupId}/${postId}`}
/>
</Helmet>
{/* <Helmet prioritizeSeoTags>
<title>A fancy webpage</title>
<link rel="notImportant" href="https://www.chipotle.com" />
<meta name="whatever" />
<meta property="og:image" content={postData?.imageUrl} />
<link rel="canonical" href="https://www.tacobell.com" />
<meta property="og:title" content="A very important title" />
</Helmet> */}

{accessToken ? <AuthorizationHeader /> : <UnAuthorizationHeader />}
<Responsive only="desktop">
<Spacing marginBottom="6.4" />
Expand Down
Empty file removed src/utils/crawler.ts
Empty file.
22 changes: 22 additions & 0 deletions src/utils/generateDynamicRoute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { allPostParsing } from './allPostParsing';

type GroupPostIdentifierTypes = {
groupId: string;
postId: string;
};

export const generateDynamicRoutes = async (apiURL: string) => {
const dynamicRoutes: string[] = []; // 동적 경로 저장 배열

try {
const data: GroupPostIdentifierTypes[] = await allPostParsing(apiURL);

data.map((items: GroupPostIdentifierTypes) => {
dynamicRoutes.push(`/detail/${items.groupId}/${items.postId}`); // 동적경로 리스트
});
} catch (e) {
console.log(e);
}

return dynamicRoutes;
};
Loading

0 comments on commit da800a7

Please sign in to comment.