diff --git a/components/category-badge.tsx b/components/category-badge.tsx index 83d25e2..8369239 100644 --- a/components/category-badge.tsx +++ b/components/category-badge.tsx @@ -11,8 +11,20 @@ type CategoryTypes = | 'Lifestyle' | 'Gadgets' | 'Other'; +const ALL_CATEGORIES = [ + 'Technology', + 'Programming', + 'Productivity', + 'Lifestyle', + 'Gadgets', + 'Other', +]; -const toPascalCase = (str: string): CategoryTypes => { +function isSuit(value: string) { + return ALL_CATEGORIES.includes(value); +} + +const toPascalCase = (str: string) => { return [str] .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) .join(''); @@ -20,5 +32,8 @@ const toPascalCase = (str: string): CategoryTypes => { export const CategoryBadge = ({ badgeString }: Props) => { const bs = badgeString ? toPascalCase(badgeString) : 'Other'; + if (!isSuit(bs)) { + return Other; + } return {bs}; }; diff --git a/content/posts/sample.mdx b/content/posts/sample.mdx index efd35b7..2128da1 100644 --- a/content/posts/sample.mdx +++ b/content/posts/sample.mdx @@ -51,9 +51,9 @@ This is a sample post. [^1] ## Table | Name | Age | Sex | -| :---- | :---: | ---: | -| John | 20 | M | -| Jane | 22 | F | +| :--- | :-: | --: | +| John | 20 | M | +| Jane | 22 | F | ## Lists diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..4d04f33 --- /dev/null +++ b/public/robots.txt @@ -0,0 +1,9 @@ +# * +User-agent: * +Allow: / + +# Host +Host: https://www.funailog.com + +# Sitemaps +Sitemap: https://www.funailog.com/sitemap.xml diff --git a/public/sitemap-0.xml b/public/sitemap-0.xml new file mode 100644 index 0000000..c5f5c5a --- /dev/null +++ b/public/sitemap-0.xml @@ -0,0 +1,8 @@ + + +https://www.funailog.com/api/hello2024-03-18T18:37:11.897Zdaily0.7 +https://www.funailog.com2024-03-18T18:37:11.897Zdaily0.7 +https://www.funailog.com/about2024-03-18T18:37:11.897Zdaily0.7 +https://www.funailog.com/posts/sample2024-03-18T18:37:11.897Zdaily0.7 +https://www.funailog.com/posts/without-category-post2024-03-18T18:37:11.897Zdaily0.7 + \ No newline at end of file diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 0000000..da3d070 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,4 @@ + + +https://www.funailog.com/sitemap-0.xml + \ No newline at end of file