All Projects → transitive-bullshit → Nextjs Notion Starter Kit

transitive-bullshit / Nextjs Notion Starter Kit

Licence: mit
Deploy your own Notion-powered website in minutes with Next.js and Vercel.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nextjs Notion Starter Kit

Blog.hellorusk.net
Tech Blog
Stars: ✭ 28 (-92.61%)
Mutual labels:  blog, portfolio, nextjs
Lowmess.com
My personal portfolio website
Stars: ✭ 99 (-73.88%)
Mutual labels:  blog, portfolio, nextjs
Leerob.io
✨ My portfolio built with Next.js, MDX, Tailwind CSS, and Vercel.
Stars: ✭ 1,369 (+261.21%)
Mutual labels:  blog, portfolio, nextjs
Anuraghazra.github.io
My Portfolio Site | Made With @Gatsbyjs
Stars: ✭ 191 (-49.6%)
Mutual labels:  blog, portfolio
Portfolio Vuepress
Vuepress portfolio
Stars: ✭ 168 (-55.67%)
Mutual labels:  blog, portfolio
Kross Hugo
Kross Creative Portfolio Template
Stars: ✭ 172 (-54.62%)
Mutual labels:  blog, portfolio
Gridsome Forestry Starter
Gridsome starter kit with Forestry (CMS)
Stars: ✭ 127 (-66.49%)
Mutual labels:  blog, portfolio
theodorusclarence.com
💠 Personal website and blog made using Next.js, TypeScript, Tailwind CSS, MDX Bundler, FaunaDB, and Preact.
Stars: ✭ 205 (-45.91%)
Mutual labels:  portfolio, nextjs
Next.js
The React Framework
Stars: ✭ 78,384 (+20581.79%)
Mutual labels:  blog, nextjs
dev-cover
🌐 Get and publish your developer portfolio with just your username
Stars: ✭ 155 (-59.1%)
Mutual labels:  portfolio, nextjs
nextjs-portfolio
Source Code for my rebranded personal website and portfolio.
Stars: ✭ 23 (-93.93%)
Mutual labels:  portfolio, nextjs
Wipi
nextjs + nestjs + TypeScript +MySQL 开发的前后端分离,服务端渲染的博客系统
Stars: ✭ 163 (-56.99%)
Mutual labels:  blog, nextjs
Hugo Theme Console
A minimal, responsive and light theme for Hugo inspired by Linux console.
Stars: ✭ 143 (-62.27%)
Mutual labels:  blog, portfolio
Felipefialho.com
😺 My personal website
Stars: ✭ 177 (-53.3%)
Mutual labels:  blog, portfolio
Paco
personal website and blog
Stars: ✭ 136 (-64.12%)
Mutual labels:  blog, nextjs
portfolio
My personal portfolio website, proudly built with Next.js, TypeScript and Tailwind
Stars: ✭ 165 (-56.46%)
Mutual labels:  portfolio, nextjs
harshhhdev.github.io
Harsh Singh's personal blog and portfolio ⚡ built with Next.js
Stars: ✭ 23 (-93.93%)
Mutual labels:  portfolio, nextjs
Portfolio
Personal portfolio 💙 Projects & Blog posts 🎨💻
Stars: ✭ 259 (-31.66%)
Mutual labels:  blog, portfolio
Gatsby Themes
Gatsby themes for blazing fast sites. We are working on the next version of the Flex theme. See https://github.com/reflexjs/reflexjs
Stars: ✭ 275 (-27.44%)
Mutual labels:  blog, portfolio
blog
Tech Blog (moved to zenn.dev/hellorusk)
Stars: ✭ 29 (-92.35%)
Mutual labels:  portfolio, nextjs

Example article page

Next.js Notion Starter Kit

The perfect starter kit for building websites with Next.js and Notion.

Build Status Prettier Code Formatting

Intro

This repo is what I use to power my personal blog / portfolio site transitivebullsh.it.

It uses Notion as a CMS, fetching content from Notion and then uses Next.js and react-notion-x to render everything.

The site is then deployed to Vercel.

Features

  • Setup only takes a few minutes (single config file) 💪
  • Robust support for Notion content via react-notion-x
  • Next.js / TS / React / Notion
  • Excellent page speeds
  • Sexy LQIP image previews
  • Embedded GitHub comments
  • Automatic open graph images
  • Automatic pretty URLs
  • Automatic table of contents
  • Full support for dark mode
  • Quick search via CMD+P just like in Notion
  • Responsive for desktop / tablet / mobile
  • Optimized for Next.js and Vercel

Setup

All config is defined in site.config.js.

  1. Fork / clone this repo
  2. Change a few values in site.config.js
  3. npm install
  4. npm run dev to test locally
  5. npm run deploy to deploy to vercel 💪

I tried to make configuration as easy as possible.

All you really need to do to get started is edit rootNotionPageId. It defaults to rendering my site's public notion page 78fc5a4b88d74b0e824e29407e9f1ec1.

You'll want to make your root Notion page public and then copy the link to your clipboard. Then extract the last part of the URL that looks like d1b5dcf8b9ff425b8aef5ce6f0730202, which is your page's Notion iD.

In order to find your Notion workspace ID (optional), just load any of your site's pages into your browser and open up the developer console. There will be a global variable that you can access called block which is the Notion data for the current page, and you just have to type block.space_id which will print out your page's workspace ID.

I recommend setting up a collection on your home page (optional; I use an inline gallery here) that contains all of your articles / projects / content. There are no structural constraints on your Notion workspace, however, so feel free to add content as you would normally in Notion. There are a few parts of the code with logic to only show comments on blog post pages (collection item detail pages).

URL Paths

The app defaults to slightly different pathnames in dev and prod (though pasting any dev pathname into prod will work and vice-versa).

In development, it will use /nextjs-notion-blog-d1b5dcf8b9ff425b8aef5ce6f0730202 which is a slugified version of the page's title suffixed with its Notion ID. I've found that it's really useful to always have the Notion Page ID front and center during local development.

In production, it will use /nextjs-notion-blog which is a bit nicer as it gets rid of the extra ID clutter.

The mapping of Notion ID to slugified page titles is done automatically for you as part of the build process. Just keep in mind that if you plan on changing page titles over time, you probably want to make sure old links will still work, and we don't currently provide a solution for detecting old links aside from Next.js built-in support for redirects.

See mapPageUrl and getCanonicalPageId from for more details.

NOTE: if you have multiple pages in your workspace with the same slugified name, the app will throw an error letting you know that there are duplicate URL pathnames.

Theming

All CSS styles that customize Notion content are located in styles/notion.css.

They mainly target global CSS classes exported by react-notion-x styles.css.

It should be pretty easy to customize most styling-related things, especially with local development and hot reload.

Dark Mode

Light Mode         Dark Mode

Dark mode is fully supported and can be toggled via the sun / moon icon in the footer.

Extras

All extra dependencies are optional -- the project should work just fine out of the box.

If you want to copy some of the fancier elements of my site, then you'll have to set up a few extras.

Fathom Analytics

Fathom provides a lightweight alternative to Google Analytics.

It's optional, but I really love how simple and elegant their solution is.

To enable analytics, just add a NEXT_PUBLIC_FATHOM_ID environment variable.

This environment variable will only be taken into account in production, so you don't have to worry about messing up your analytics with localhost development.

GitHub Comments

Embedded GitHub Comments

Utteranc.es is an amazing open source project which enables developers to embed GitHub issues as a comments section on their websites. Genius.

The integration is really simple. Just edit the utterancesGitHubRepo config value to point to the repo you'd like to use for issue comments.

You probably want to read through the Utterances docs before enabling this in production, since there are some subtleties around how issues get mapped to pages on your site, but overall the setup was super easy imho and I love the results.

Preview Images

This is a really cool feature that's inspired by Medium's smooth image loading, where we first load a low quality, blurred version of an image and animate in the full quality version once it loads. It's such a nice effect, but it does add a bit of work to set up.

If isPreviewImageSupportEnabled is set to true, then the app will compute LQIP images via lqip-modern for all images referenced by your Notion workspace. These will be stored in a Google Firebase collection (as base64 JPEG data), so they only need to be computed once.

You'll have to set up your own Google Firebase instance of Firestore and supply three environment variables:

# base64-encoded string containing your google credentials json file
GOOGLE_APPLICATION_CREDENTIALS=

# name of your google cloud project
GCLOUD_PROJECT=

# name of the firebase collection to store images in
FIREBASE_COLLECTION_IMAGES=

The actual work happens in the create-preview-image serverless function.

Automatic Social Images

Auto-generated social image

Open Graph images like this one will be generated for each page of your site automatically based each page's content.

By default, it takes into account:

  • cover image (falling back to a default site-wide cover image)
  • page icon (falling back to a default site-wide icon)
  • page title
  • page subtitle (optional; pulled from the "Description" property of collection pages)

This feature works by rendering some custom HTML to a Puppeteer instance in this serverless function that takes in the page ID as input.

Here's an example of a social image URL in production: /api/render-social-image/71201624b204481f862630ea25ce62fe

Note that you shouldn't have to do anything extra to enable this feature as long as you're deploying to Vercel.

Automatic Table of Contents

Smooth ToC Scrollspy

By default, every article page will have a table of contents displayed as an aside on desktop. It uses scrollspy logic to automatically update the current section as the user scrolls through your document, and makes it really easy to jump between different sections.

If a page has less than minTableOfContentsItems (default 3), the table of contents will be hidden. It is also hidden on the index page and if the browser window is too small.

This table of contents uses the same logic that Notion uses for its built-in Table of Contents block (see getPageTableOfContents for the underlying logic and associated unit tests).

Screenshots

Mobile Article Page

Mobile Article Page

Desktop Home Page

Desktop Home Page

Desktop Article Page (Dark Mode)

Desktop Article Page

License

MIT © Travis Fischer

Support my open source work by following me on twitter twitter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].