timlrx / tailwind-nextjs-starter-blog

This is a Next.js, Tailwind CSS blogging starter template. Comes out of the box configured with the latest technologies to make technical writing a breeze. Easily configurable and customizable. Perfect as a replacement to existing Jekyll and Hugo individual blogs.
https://tailwind-nextjs-starter-blog.vercel.app/
MIT License
8.82k stars 2.05k forks source link

Few improvments #777

Closed PxlSyl closed 6 months ago

PxlSyl commented 11 months ago

Hi!

While working on the i18n version, I noticed a few things. These are really minor improvments that being said!

For capitalized tags, in the [tag] page, you can do something like this

function capitalizeFirstLetter(str: string): string { return str.charAt(0).toUpperCase() + str.slice(1) } const capitalizedTag = capitalizeFirstLetter(tag) return genPageMetadata({ title: capitalizedTag, ...

'use client'

import { useParams, usePathname } from 'next/navigation' import siteMetadata from '@/data/siteMetadata' import headerNavLinks from '@/data/headerNavLinks' import Logo from '@/data/logo.svg' import Link from './Link' import MobileNav from './MobileNav' import ThemeSwitch from './ThemeSwitch' import LangSwitch from './LangSwitch' import SearchButton from './SearchButton' import { useTranslation } from 'app/[locale]/i18n/client' import type { LocaleTypes } from 'app/[locale]/i18n/settings'

const Header = () => { const locale = useParams()?.locale as LocaleTypes const { t } = useTranslation(locale, '') // Get current page path const pathname = usePathname()

return (

{typeof siteMetadata.headerTitle === 'string' ? (
{siteMetadata.headerTitle}
) : ( siteMetadata.headerTitle )}
{headerNavLinks .filter((link) => link.href !== '/') .map((link) => { const isSelected = pathname.includes(link.href) return ( {t(`${link.title.toLowerCase()}`)} ) })}

) }

export default Header

PrinOrange commented 11 months ago

In fact, for capitalization, yo can do it better with CSS text-transform property, here is the description.

.capitalize{
        text-transform: capitalize;
}

It can rectify to capitalize the first letter in word automatically, and the browser would recognize the words to determine what word should be capitalized and what is not necessary.

PxlSyl commented 11 months ago

In fact, for capitalization, yo can do it better with CSS text-transform property, here is the description.

.capitalize{
        text-transform: capitalize;
}

It can rectify to capitalize the first letter in word automatically, and the browser would recognize the words to determine what word should be capitalized and what is not necessary.

Yeah but thing is, it's for metadata generation and it goes directly to the tab

PxlSyl commented 9 months ago

Hi! I also added a share component, and the support for post series, if anyone is interested!