Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Fixed problem
Browse files Browse the repository at this point in the history
  • Loading branch information
paveg committed Mar 18, 2024
1 parent 360784d commit 993d11e
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
17 changes: 16 additions & 1 deletion components/category-badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,29 @@ 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('');
};

export const CategoryBadge = ({ badgeString }: Props) => {
const bs = badgeString ? toPascalCase(badgeString) : 'Other';
if (!isSuit(bs)) {
return <Badge variant="secondary">Other</Badge>;
}
return <Badge variant="secondary">{bs}</Badge>;
};
6 changes: 3 additions & 3 deletions content/posts/sample.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 9 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# *
User-agent: *
Allow: /

# Host
Host: https://www.funailog.com

# Sitemaps
Sitemap: https://www.funailog.com/sitemap.xml
8 changes: 8 additions & 0 deletions public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://www.funailog.com/api/hello</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/about</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/posts/sample</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://www.funailog.com/posts/without-category-post</loc><lastmod>2024-03-18T18:37:11.897Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
4 changes: 4 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://www.funailog.com/sitemap-0.xml</loc></sitemap>
</sitemapindex>

0 comments on commit 993d11e

Please sign in to comment.