Skip to content

Commit

Permalink
Merge pull request #20 from Team-INSERT/refactor/useConfig
Browse files Browse the repository at this point in the history
REFACTOR : contents parser로 오픈그래프를 열었을 때 태그 내용이 보이지 않게 수정
  • Loading branch information
Ubinquitous authored May 7, 2023
2 parents 16b4857 + c3bab7d commit cd7c7a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pages/docs/[title].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Doc = ({ docs }: SingleDocsPropsType) => {
const { isLogined } = useUser()
const { seoConfig } = useConfig({
title: `부마위키 - ${docs.title} (${util.typeEditor(docs.docsType)})`,
description: `${docs.contents.slice(0, 16)}...`,
description: seoContentParser(docs.contents),
})
const { getIsLike, createLike, deleteLike } = useLikeCountById(docs.id)

Expand Down
9 changes: 9 additions & 0 deletions utils/document/seoContentParser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const seoContentParser = (contents: string) => {
const seoContents = `${contents
.replace(/<br>/gi, ' ')
.replace(/<소제목>/gi, '')
.replace(/<\/소제목>/gi, ':')
.slice(0, 20)}...`

return seoContents
}

0 comments on commit cd7c7a9

Please sign in to comment.