NextSSS is a Next.js starter template especially for static site including full setup for TypeScript, Tailwind CSS, Google Analytics, Next SEO, active link component, etc.
Execute create-next-app
with npm or Yarn to bootstrap the template:
npx create-next-app --example https://github.com/ixkaito/nextsss
or
yarn create next-app --example https://github.com/ixkaito/nextsss
Edit GA_TRACKING_ID
in /lib/gtag.ts
.
Example:
export const GA_TRACKING_ID = 'G-XXXXXXXXXX'
Example:
import Link from '../components/ActiveLink'
const Nav: React.FC = () => {
return (
<nav>
<Link href="/">
<a>Home</a>
</Link>
<Link href="/about/">
<a>About</a>
</Link>
</nav>
)
}
export default Nav
This will dynamically add the active
class name to each links. You can also change the activeClassName
like this:
import Link from '../components/ActiveLink'
const Nav: React.FC = () => {
return (
<nav>
<Link href="/" activeClassName="current">
<a>Home</a>
</Link>
<Link href="/about/" activeClassName="current">
<a>About</a>
</Link>
</nav>
)
}
export default Nav
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
MIT