diff --git a/.github/workflows/sitemap-ping.yml b/.github/workflows/sitemap-ping.yml new file mode 100644 index 00000000..468f1fac --- /dev/null +++ b/.github/workflows/sitemap-ping.yml @@ -0,0 +1,14 @@ +name: Sitemap Ping Schedule + +on: + schedule: + - cron: '0 0 * * *' + +jobs: + cron: + name: Cron + + runs-on: ubuntu-latest + + steps: + - run: curl https://www.google.com/ping\?sitemap\=https://www.knoticle.app/sitemap.xml diff --git a/frontend/components/common/Content/styled.ts b/frontend/components/common/Content/styled.ts index 955335f8..5f4a2a29 100644 --- a/frontend/components/common/Content/styled.ts +++ b/frontend/components/common/Content/styled.ts @@ -40,6 +40,11 @@ export const ContentBody = styled.div` margin: 16px 0 8px 0; } + ol, + ul { + padding-left: 16px; + } + ol { list-style-type: decimal; } diff --git a/frontend/components/search/ArticleItem/styled.ts b/frontend/components/search/ArticleItem/styled.ts index d59040dc..bd4965d0 100644 --- a/frontend/components/search/ArticleItem/styled.ts +++ b/frontend/components/search/ArticleItem/styled.ts @@ -22,9 +22,15 @@ export const ItemGroup = styled.div` export const ItemTitle = styled(TextMedium)` margin-bottom: 16px; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 1; + -webkit-box-orient: vertical; `; export const ItemContent = styled(TextSmall)` + word-break: break-all; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; diff --git a/frontend/components/viewer/ArticleContent/index.tsx b/frontend/components/viewer/ArticleContent/index.tsx index 67c2bf61..c24df606 100644 --- a/frontend/components/viewer/ArticleContent/index.tsx +++ b/frontend/components/viewer/ArticleContent/index.tsx @@ -115,9 +115,7 @@ export default function Article({ {!article.deleted_at ? ( - - {article.title} - + {article.title} diff --git a/frontend/components/viewer/ArticleContent/styled.ts b/frontend/components/viewer/ArticleContent/styled.ts index 0fe75bc2..6d5ced7f 100644 --- a/frontend/components/viewer/ArticleContent/styled.ts +++ b/frontend/components/viewer/ArticleContent/styled.ts @@ -45,11 +45,13 @@ export const ArticleMain = styled(Flex)` padding: 50px 16px; } `; -export const ArticleTitle = styled.div` +export const ArticleTitle = styled.h1` width: 100%; border-bottom: 1px solid black; padding: 25px 0; text-align: left; + font-size: 24px; + font-weight: 700; `; export const ArticleTitleBtnBox = styled(Flex)` flex-wrap: wrap; diff --git a/frontend/pages/search.tsx b/frontend/pages/search.tsx index bb174894..137e8e64 100644 --- a/frontend/pages/search.tsx +++ b/frontend/pages/search.tsx @@ -37,7 +37,7 @@ export default function Search() { const [isArticleNoResult, setIsArticleNoResult] = useState(false); const [isBookNoResult, setIsBookNoResult] = useState(false); - const highlightWord = (text: string, words: string[]): React.ReactNode => { + const highlightWord = (text: string, words: string[], isFirst = false): React.ReactNode => { let wordIndexList = words.map((word) => text.toLowerCase().indexOf(word.toLowerCase())); const filteredWords = words.filter((_, index) => wordIndexList[index] !== -1); @@ -51,11 +51,19 @@ export default function Search() { const endIndex = startIndex + targetWord.length; + let paddingIndex = 0; + + if (isFirst) { + const regex = /(<([^>]+)>)/g; + + while (regex.test(text.slice(0, startIndex))) paddingIndex = regex.lastIndex; + } + return ( <> - {text.slice(0, startIndex)} + {text.slice(paddingIndex, startIndex)} {text.slice(startIndex, endIndex)} - {highlightWord(text.slice(endIndex), words)} + {highlightWord(text.slice(endIndex).replace(/(<([^>]+)>)/gi, ''), words)} ); }; @@ -134,15 +142,15 @@ export default function Search() { setIsArticleNoResult(false); const newArticlesHighlighted = newArticles.data.map((article: IArticle) => { - const keywords = debouncedKeyword.trim().split(' '); + const keywords = debouncedKeyword + .trim() + .split(' ') + .filter((word: string) => word); return { ...article, title: highlightWord(article.title, keywords), - content: highlightWord( - article.content.slice(0, 400).replace(/(<([^>]+)>)/gi, ''), - keywords - ), + content: highlightWord(article.content, keywords, true), }; }); @@ -167,7 +175,10 @@ export default function Search() { setIsBookNoResult(false); const newBooksHighlighted = newBooks.data.map((book: IBook) => { - const keywords = debouncedKeyword.trim().split(' '); + const keywords = debouncedKeyword + .trim() + .split(' ') + .filter((word: string) => word); return { ...book,