fix: tag formatting

This commit is contained in:
Cory Dransfeldt 2024-03-14 11:36:10 -07:00
parent 2f3b6b1f57
commit 5d9b2efd32
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View file

@ -187,10 +187,13 @@ export default {
return tags.filter((tag) => tag.toLowerCase() !== 'posts') return tags.filter((tag) => tag.toLowerCase() !== 'posts')
}, },
formatTag: (string) => { formatTag: (string) => {
const capitalizeFirstLetter = (string) => { const capitalizeFirstLetter = (string) => string.charAt(0).toUpperCase() + string.slice(1)
return string.charAt(0).toUpperCase() + string.slice(1); const normalizedString = string.toLowerCase()
} if (
if (string === 'iOS' || string === 'macOS' || string === 'RSS') return `#${string}` normalizedString === 'ios' ||
normalizedString === 'macos' ||
normalizedString === 'rss'
) return `#${string}`
if (!string.includes(' ')) return `#${capitalizeFirstLetter(string)}` if (!string.includes(' ')) return `#${capitalizeFirstLetter(string)}`
return `#${string.split(' ').map(s => capitalizeFirstLetter(s)).join('')}` return `#${string.split(' ').map(s => capitalizeFirstLetter(s)).join('')}`
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "coryd.dev", "name": "coryd.dev",
"version": "7.10.5", "version": "7.10.6",
"description": "The source for my personal site. Built using 11ty.", "description": "The source for my personal site. Built using 11ty.",
"type": "module", "type": "module",
"scripts": { "scripts": {