NotionPresso Blog Template Guide

Creating Your Blog with Notion: The Perfect Guide for Developers

Tistory? Medium? Velog? Stuck choosing a blogging platform? πŸ˜…

As a developer starting a blog, these thoughts might feel familiar:

  • β€’

    "Do I need to look up Markdown syntax again..."

  • β€’

    "Why is it so complicated to upload just one image?"

  • β€’

    "The code block styling just doesn't feel right..."

  • β€’

    "I want a truly 'my own' blog without being tied to a platform..."

Being locked into a platform can feel especially restrictive. You want to customize things your way, but you're confined within limited features. πŸ”’

But what if you could solve all these problems using Notion, the tool you already use every day?

Using the open-source project NotionPresso, you can:

  • β€’

    Keep using Notion's familiar editing environment

  • β€’

    Create a fully customizable blog

  • β€’

    Have a truly personal blog! πŸŽ‰

Plus, being open-source means no cost concerns. You can even contribute your own improvements.

This guide will walk you through the entire process of creating and managing a blog with NotionPresso. From writing in Notion to SEO optimization and commenting features - let's create your perfect blog! πŸš€

Ready to begin?

πŸ—ΊοΈ Complete Guide Map

We'll cover these topics in order:

  1. 1

    Starting with Notion Blog (Current Chapter)

    • β€’

      NotionPresso Introduction

    • β€’

      Benefits of Notion Blogging

  1. 2

    Development Environment Setup

    • β€’

      Node.js and Git Installation

    • β€’

      Basic Tools Configuration

  1. 3

    Understanding the Project Structure

    • β€’

      Explanation of Main Folders and Files

    • β€’

      Finding Points for Customization

  1. 4

    Notion API Integration

    • β€’

      Getting API Keys

    • β€’

      Setting Up Notion Page Permissions

  1. 5

    Writing Your First Post

    • β€’

      Writing in Notion

    • β€’

      Blog Integration

  1. 6

    Cloudflare Deployment

    • β€’

      Setting Up Free Hosting

    • β€’

      Connecting Your Domain

  1. 7

    Adding Blog Features

    • β€’

      Implementing Comments

    • β€’

      Adding Visitor Analytics (Plausible)

  1. 8

    SEO Optimization

    • β€’

      Google Search Console Setup

    • β€’

      Search Exposure Optimization

  1. 9

    Effective Blog Management Tips

    • β€’

      Technical Blog Writing Best Practices

    • β€’

      Increasing Visitor Traffic

Let's dive in! πŸš€

Setting Up Your Development Environment: A Step-by-Step Guide for Beginners

πŸ’‘ "What's a terminal?", "I'm new to Git..." Don't worry! We'll explain everything in detail.

Before We Begin

The tools we'll install serve these purposes:

  • β€’

    Node.js: The engine that runs your blog

  • β€’

    Git: Tool for managing and deploying your blog code

  • β€’

    VSCode: Editor for writing and editing code

Think of them as the engine, steering wheel, and navigation system of a car!

New to Terminal?

The terminal (or command prompt) is like a conversation window with your computer.

  • β€’

    Windows: Press Windows key + R and type 'cmd'

  • β€’

    Mac: Search for 'Terminal' in Spotlight (⌘ + Space)

Basic commands:

  • β€’

    cd foldername: Navigate to a folder

  • β€’

    dir(Windows) / ls(Mac): View files in current folder

  • β€’

    cls(Windows) / clear(Mac): Clear screen

1. Installing Node.js

Windows Users

  1. 1

    Visit Node.js official site and click LTS version

  1. 2

    Run downloaded file

  1. 3

    Keep clicking "Next" (maintain default settings)

Mac Users

Run in terminal:

Shell
# Install Homebrew first if you don't have it /bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)" # Install Node.js brew install node

Verify Installation

Enter in terminal:

Shell
node --version npm --version

Success if you see numbers! (e.g., v18.17.0)

2. Installing Git

Windows Users

  1. 1

    Download Git for Windows

  1. 2

    Run installer

  1. 3

    Click "Next" with default settings

    • β€’

      Make sure to check "Git Bash" installation!

Mac Users

Run in terminal:

Shell
brew install git

Verify Installation

Shell
git --version

3. Installing VSCode

  1. 2

    Run installer

  1. 3

    (Optional) Install extensions:

    • β€’

      ESLint: Code error checking

    • β€’

      Prettier: Automatic code formatting

    • β€’

      Korean Language Pack: Korean menus (if needed)

4. Creating a GitHub Account

  1. 1

    Visit GitHub

  1. 2

    Click "Sign Up"

  1. 3

    Enter email and password

  1. 4

    Complete email verification

5. Initial Git Configuration

Run in terminal (replace with your information):

Shell
git config --global user.name "Your Name" git config --global user.email "your@email.com"

Common Issues and Solutions

1. "Command not found" Error

  • β€’

    Windows: Check PATH environment variable

    1. 1

      Windows key + R β†’ Enter "systempropertiesadvanced"

    1. 2

      Environment Variables β†’ Check Path for installation directory

  • β€’

    Mac: Try restarting Terminal

2. Git Configuration Errors

  • β€’

    Check for spaces in quotation marks

  • β€’

    Verify email address format

3. Opening Terminal in VSCode

  1. 1

    Launch VSCode

  1. 2

    Press Ctrl + ` or View β†’ Terminal from top menu

Installation Checklist

Node.js installed (node --version works)

Git installed (git --version works)

VSCode installed with extensions

GitHub account created

Git account configured

πŸŽ‰ Congratulations! All your development tools are now ready. In the next section, we'll use these tools to create your actual blog!

Exploring the NotionPresso Project: A Guide for Beginners

πŸ’‘ "Too many folders!", "Not sure where to start modifying..." Don't worry! We'll guide you through step by step.

Getting Started: Create Your Own Notion Blog GitHub Repo

Click the Use this template button at the top right β‡’ Select Create a new repository.

Set the Owner and enter the Repository Name.

After entering all the information, click the Create repository button.

Clicking the button will create a repository based on the template

Now, the repository for creating your Notion blog is ready!

Getting Started: Project Setup

First, let’s clone the project to your computer. In the created repository, click the Code button and copy the repository URL.

Shell
# Clone the project # git clone https://github.com/user-name/notion-blog.git my-blog git clone <copied-url> my-blog # Move into project folder cd my-blog # Install necessary packages npm install

Understanding Core Folder Structure

Our blog's structure is organized as follows:

Plain text
my-blog/ β”œβ”€β”€ app/ # Pages and routing β”œβ”€β”€ components/ # Reusable components β”œβ”€β”€ content/ # Blog post listings β”œβ”€β”€ notion-data/ # Data fetched from Notion └── public/ # Static files like images

Key Files for Modification

1. Modifying Basic Information

app/layout.tsx:

  • β€’

    Blog title

  • β€’

    Description

  • β€’

    SEO information

Typescript
export const metadata = { title: { default: 'Your Blog Name', // Modify here template: '%s | Your Blog Name', // Modify here }, description: 'Blog description...', // Modify here // ... }

2. Setting Up Your Profile

app/page.tsx:

  • β€’

    Profile image

  • β€’

    Introduction text

Typescript
<Image src="/profile.png" // Add image to public folder and update path alt="Profile Image" width={100} height={100} />

components/nav.tsx:

  • β€’

    Add/modify menu items

Typescript
const navItems = { '/': { name: 'Home' }, '/blog': { name: 'Blog' }, '<https://github.com/yourusername>': { name: 'GitHub' }, // Modify }

4. Managing Blog Posts

content/posts.ts:

  • β€’

    Manage posts written in Notion

  • β€’

    Automatically updated by NotionPresso CLI

Special Features

1. Dark Mode

  • β€’

    Managed in components/theme.tsx

  • β€’

    Automatically follows system settings

2. RSS Feed

  • β€’

    Generated in app/rss/route.ts

  • β€’

    Feature for blog subscribers

3. SEO Optimization

  • β€’

    app/sitemap.ts: Sitemap for search engines

  • β€’

    app/robots.ts: Search engine crawling settings

  • β€’

    app/og/route.tsx: Social media sharing images

Additional Customization

  1. 1

    Modifying Styles

    • β€’

      app/global.css: Global styles

    • β€’

      Using Tailwind CSS (tailwind.config.js)

  1. 2

    Image Management

    • β€’

      Store images in public/ folder

    • β€’

      public/notion-data/: Images imported from Notion

Important Notes

  • β€’

    Don't modify the notion-data/ folder directly as it's auto-generated

  • β€’

    Always test changes with npm run dev

πŸŽ‰ Now that you understand the project structure, let's move on to connecting the Notion API in the next section!

Customization Tips

Styling Best Practices

  1. 1

    Use Tailwind classes when possible for consistency

  1. 2

    Keep global styles minimal

  1. 3

    Leverage CSS variables for theme customization

Component Structure

  1. 1

    Keep components small and focused

  1. 2

    Use TypeScript for better type safety

  1. 3

    Follow the folder structure conventions

Common Customization Points

  1. 1

    Color scheme

  1. 2

    Typography

  1. 3

    Layout spacing

  1. 4

    Navigation structure

  1. 5

    Post display format

Development Workflow

  1. 1

    Make changes in development mode

  1. 2

    Test thoroughly before deployment

  1. 3

    Keep backups of customized files

  1. 4

    Document your modifications

Performance Considerations

  1. 1

    Optimize images before adding to public folder

  1. 2

    Minimize external dependencies

  1. 3

    Use dynamic imports when appropriate

  1. 4

    Keep bundle size in check

Troubleshooting Common Issues

Build Errors

  • β€’

    Check for missing dependencies

  • β€’

    Verify file paths are correct

  • β€’

    Ensure all required environment variables are set

Style Issues

  • β€’

    Inspect CSS specificity

  • β€’

    Check for conflicting Tailwind classes

  • β€’

    Verify media queries for responsiveness

Component Errors

  • β€’

    Check prop types

  • β€’

    Verify component imports

  • β€’

    Debug with React Developer Tools

πŸ’‘ Remember: The project structure is designed to be modular and maintainable. Don't be afraid to explore and customize, but always keep a backup of your changes!

Connecting Notion API: Fetching Blog Data

πŸ’‘ Ready to take the first real step towards your awesome blog? Let's set up the Notion data fetching configuration together!

Step 1: Creating a Notion Integration

[Notion Integration Setup Screenshot]

  1. 1

    Visit Notion developers page (https://developers.notion.com/)

  1. 2

    Click "View my integrations"

  1. 3

    Click "New integration" button

  1. 4

    Set Integration name (e.g., "My Blog")

  1. 5

    Select Workspace

  1. 6

    Select Type

    1. a

      Click Save Button and Configure integration settings

    1. a

      Save the generated Integration Token (you'll need this later!)

Β 

Step 2: Setting Page Connection Permissions

[Notion Page Share Settings Screenshot]

  1. 1

    Open the Notion page where you'll write the blog post β‡’ Click the three dots (β—‹ β—‹ β—‹) button in the top right corner β‡’ Click "Connect to" β‡’ Search for and select the integration you just created.

Β 

  1. 1

    Select the integration to grant permissions.

  1. 2

    Check the permissions.

Step 3: Getting the Page ID

[Notion Page URL Display Screenshot]

  1. 1

    Copy your Notion page URL

  1. 2

    Find the page ID in the URL! Example: https://notion.so/myblog/[this-is-your-page-ID]

Step 4: Copying Notion Data to NotionPresso

Run these commands in your terminal:

Typescript
// Install CLI npm install -g @notionpress/cli // Copy Notion data to your project npx npresso --page {{page-url}} --auth {{notion-api-key}}

@notionpresso/cli is designed to work with Next.js project structure. The extracted data is stored in the following structure:

Plain text
my-notion-blog/ β”œβ”€β”€ notion-data/ β”‚ β”œβ”€β”€ page-id-1.json β”‚ β”œβ”€β”€ page-id-2.json β”‚ └── ... └── public/ └── images/ β”œβ”€β”€ page-id-1/ β”‚ β”œβ”€β”€ image1.png β”‚ └── image2.jpg β”œβ”€β”€ page-id-2/ β”‚ └── image1.png └── ...

Key options for @notionpresso/cli:

  • β€’

    dir: Specify directory for JSON files. Default is ./notion-data

  • β€’

    image-dir: Specify directory for image files. Default is ./public/images

For example, if you want to change storage locations:

Shell
npx notion-dump --page YOUR_PAGE_URL --auth YOUR_API_KEY --dir ./data --image-dir ./public/assets/images

NotionPresso Components

@notionpresso/react Component Library

NotionPresso is a React component library designed to replicate Notion's block-based editing experience on the web. Through its hierarchical structure, it can accurately render all Notion elements.

Key Component Details

1. <Notion> Component

The top-level container component that provides Notion-style typography and layout. This component provides style context for all Notion elements within it, so it must be positioned at the top level.

Typescript
<Notion> {/* Other Notion components go here */} </Notion>

2. <Notion.Cover> Component

Displays the post's cover image. Automatically applies the same ratio and style as Notion's cover images. Automatically hides if no image is present.

Typescript
<Notion.Cover src={post.image} />

3. <Notion.Body> Component

Container for main content. Automatically applies appropriate padding and margins, and supports responsive layout. Provides optimal readability on mobile devices.

4. <Notion.Title> Component

Renders the post title. Applies the same typography and spacing as Notion titles and automatically generates SEO-optimized HTML structure.

5. <Notion.Blocks> Component

Automatically recognizes and renders various Notion block types. Supported block types:

  • β€’

    Text blocks (supports various styling)

  • β€’

    Image blocks (automatic optimization)

  • β€’

    Code blocks (syntax highlighting support)

  • β€’

    Lists (nested support)

  • β€’

    Tables

  • β€’

    To-do lists

  • β€’

    Blockquotes

  • β€’

    Dividers

Using the NotionRenderer Component

components/notion-renderer.tsx is a wrapper component that effectively combines these components:

Typescript
'use client' import { Notion } from "@notionpresso/react"; import type { Post } from "content/posts"; export default function NotionRenderer({ post }: { post: Post }) { return ( <Notion> <Notion.Cover src={post.image} /> <Notion.Body> <Notion.Title title={post.title} /> <Notion.Blocks blocks={post.content.blocks} /> </Notion.Body> </Notion> ) }

This component has the following characteristics:

  1. 1

    'use client' directive: Functions as a Next.js client component to support interactive features

  1. 2

    Type safety: Utilizes TypeScript's type checking capabilities with Post type

  1. 3

    Structural consistency: Maintains component structure that reflects Notion's document structure

  1. 4

    Automatic optimization: Handles image optimization, code syntax highlighting automatically

Real Usage Example

3.3. Registering Post Metadata

Modify content/posts.ts file:

Typescript
import newPost from '../notion-data/your-page-id.json' const posts = [ { title: "My First Blog Post", slug: "first-post", content: newPost, date: "2024-10-22", description: "Starting my blog journey...", image: undefined }, // ... existing posts ];

In your blog post page, you can use it like this:

Typescript
// app/blog/[slug]/page.tsx import NotionRenderer from '@/components/notion-renderer' import posts from 'content/posts' export default function BlogPost({ params }: { params: { slug: string } }) { const post = posts.find(p => p.slug === params.slug) if (!post) return <div>Post not found</div> return <NotionRenderer post={post} /> }

With this setup, content written in Notion will appear identical on your website, with automatic responsive design and dark mode support.

πŸŽ‰ Now that we've set up the Notion API connection, you're ready to start writing your first blog post! In the next section, we'll learn how to write and publish your first post.

Writing Your First Post: From Notion to Blog

πŸ’‘ Ready to start the core part of blogging? Let's walk through the process of writing in Notion and publishing it to your blog!

Step 1: Writing in Notion

  • β€’

    Create New Page: Create a new page in Notion for your blog post.

  • β€’

    Write Title: Enter your post title at the top of the page.

  • β€’

    Create Content: Write your content freely. You can use various blocks including text, images, code blocks, and more.

  • β€’

    Set Cover Image (Optional): Click 'Add Cover' at the top of the page to add a cover image. This will serve as the featured image for your blog post.

Step 2: Verify Page Sharing and Integration Permissions

  • β€’

    Check Integration Access: Verify that your previously created Notion Integration is invited to the page. Click the 'Share' button in the top right corner and confirm the Integration is listed.

  • β€’

    Public Access (Optional): If you're running a public blog, you don't need to make the page public on the web. The Integration will handle data fetching.

Step 3: Get the Page ID

  • β€’

    Copy Page URL: Open your Notion page and copy the URL from your browser's address bar.

  • β€’

    Extract Page ID: Get the page ID from the URL.

    • β—¦

      Example: https://www.notion.so/yourworkspace/post-title-**abcd1234efgh5678ijkl9012mnop3456**

Step 4: Fetch Data Using NotionPresso CLI

Run the following command in your terminal to fetch the Notion page data:

Shell
# Run this in your project root directory # Install NotionPresso CLI (first time only) npm install -g @notionpresso/cli # Fetch Notion data npresso --page [page URL or ID] --auth [Notion Integration token]
  • β€’

    [page URL or ID]: Enter either the full page URL you copied or just the page ID

  • β€’

    [Notion Integration token]: Enter the Secret key you received when creating your Notion Integration

Example:

Shell
npresso --page {{page URL or ID}} --auth {{Notion Integration token}}

Step 5: Add Post Information to content/posts.ts

Open content/posts.ts file and register your new post's metadata:

Typescript
import newPost from '../notion-data/abcd1234efgh5678ijkl9012mnop3456.json'; const posts = [ { title: "My First Blog Post", slug: "first-post", content: newPost, date: "2023-10-24", description: "Beginning my blogging journey...", image: newPost.coverImage, // if you have a cover image }, // Keep existing posts if any ]; export default posts;
  • β€’

    import path filename: This is your page ID with .json extension

  • β€’

    Field meanings:

    • β—¦

      title: Post title

    • β—¦

      slug: Post identifier for URL (e.g., yourblog.com/blog/first-post)

    • β—¦

      content: The Notion data we just fetched

    • β—¦

      date: Post creation date (YYYY-MM-DD format)

    • β—¦

      description: Post summary or description

    • β—¦

      image: Cover image URL (if available)

Step 6: Check on Local Server

Start the development server in your terminal:

Shell
npm run dev

Visit http://localhost:3000 in your browser to verify your blog displays correctly. Success if your new post appears in the blog list and shows proper content when clicked!

Writing Tips for Your First Post

Structure Your Content Well

  • β€’

    Use clear headings and subheadings

  • β€’

    Break content into digestible sections

  • β€’

    Include relevant code examples where needed

  • β€’

    Add images to illustrate complex points

Optimize for Readability

  • β€’

    Keep paragraphs concise

  • β€’

    Use bullet points for lists

  • β€’

    Include code snippets with proper syntax highlighting

  • β€’

    Add relevant images or diagrams

SEO Best Practices

  • β€’

    Write a compelling title

  • β€’

    Include relevant keywords naturally

  • β€’

    Add meta description in your post metadata

  • β€’

    Use proper heading hierarchy

Technical Considerations

  • β€’

    Test all code snippets

  • β€’

    Verify image loading

  • β€’

    Check mobile responsiveness

  • β€’

    Ensure proper formatting of code blocks

Common Issues and Solutions

Post Not Showing Up?

  • β€’

    Check if the page ID is correct

  • β€’

    Verify Integration permissions

  • β€’

    Ensure the post is properly added to posts.ts

Images Not Loading?

  • β€’

    Verify image paths

  • β€’

    Check cover image URL

  • β€’

    Ensure images are properly uploaded

Formatting Issues?

  • β€’

    Check Notion block compatibility

  • β€’

    Verify markdown formatting

  • β€’

    Review code block syntax

πŸŽ‰ Congratulations! Your first post from Notion is now live on your blog.

After publishing your first post, consider:

  • β€’

    Share it on social media

  • β€’

    Add tags or categories

  • β€’

    Enable comments

  • β€’

    Set up analytics

  • β€’

    Plan your next post!

Remember, the first post is always the hardest. Each post after this will get easier as you become more familiar with the workflow. Keep writing, keep sharing, and most importantly, enjoy the process! 🌱

πŸ’‘ Pro Tip: Keep a list of post ideas in Notion to maintain a steady content pipeline for your blog.

Deploying Your Next.js Blog to Cloudflare Pages

1. Preparing Your Next.js Blog Project

This guide will walk you through the step-by-step process of deploying your project to Cloudflare Pages.

2. Connecting to Cloudflare Pages

2-1. GitHub Integration

  1. 1

    Go to Cloudflare Pages and create an account. If you already have one, just log in.

  1. 2

    Create a new project in Cloudflare Pages.

  1. 3

    Connect your GitHub account and select the Next.js project repository you want to deploy.

2-2. Framework Selection and Build Settings

While Cloudflare Pages will recognize that your project is built with Next.js, you should manually select 'Next.js' as the framework.

  • β€’

    Build command: By default, the next build command will be used automatically.

  • β€’

    Output directory: No special configuration needed; Cloudflare will automatically handle Next.js static files.

3. Setting Up Node.js Compatibility Flag

Since Cloudflare Pages operates in a serverless environment, some Node.js features might not be compatible by default. To resolve this, you need to activate the Node.js compatibility flag.

  • β€’

    Enable the nodejs_compat flag in your Cloudflare Pages project settings. This flag ensures that Node.js-based features work properly in Cloudflare Pages.

4. Deployment and Redeployment

4-1. Initial Deployment

When you push code to your GitHub repository, Cloudflare Pages will automatically start the build and deployment process. The build command and output settings are handled automatically based on your framework selection.

4-2. Redeployment

After code modifications or setting changes, pushing a new commit to GitHub will trigger automatic redeployment. With the nodejs_compat flag enabled, Node.js compatibility issues will be resolved during deployment.

5. Verifying Deployment

After the build completes, you can access your site through the URL provided by Cloudflare. You can also set up a custom domain to run your site on your preferred domain.

6. Redeployment After Enabling Node.js Compatibility

For projects using Node.js features, make sure to redeploy after enabling the compatibility flag to ensure all features work correctly.

Troubleshooting Common Deployment Issues

Build Failures

  • β€’

    Check your build logs for specific errors

  • β€’

    Verify your dependencies are correctly listed in package.json

  • β€’

    Ensure your Node.js version is compatible

Route Issues

  • β€’

    Verify your Next.js routing configuration

  • β€’

    Check for any hard-coded paths

  • β€’

    Ensure dynamic routes are properly set up

Asset Loading Problems

  • β€’

    Check your image and static file paths

  • β€’

    Verify public directory structure

  • β€’

    Ensure proper asset optimization settings

Configuration Best Practices

Environment Variables

  1. 1

    Set up environment variables in Cloudflare Pages dashboard

  1. 2

    Double-check sensitive information is properly secured

  1. 3

    Use appropriate production values

Build Settings

  1. 1

    Optimize build cache usage

  1. 2

    Set appropriate Node.js version

  1. 3

    Configure build command if needed

Custom Domain Setup

  1. 1

    Add your domain in Cloudflare Pages settings

  1. 2

    Configure DNS settings

  1. 3

    Wait for SSL certificate provisioning

Performance Optimization Tips

Caching Strategy

  • β€’

    Configure appropriate cache headers

  • β€’

    Utilize Cloudflare's edge caching

  • β€’

    Implement static page generation where possible

Asset Optimization

  • β€’

    Compress images and other assets

  • β€’

    Use appropriate loading strategies

  • β€’

    Implement lazy loading where beneficial

Security Considerations

  • β€’

    Enable all relevant security headers

  • β€’

    Configure appropriate CSP settings

  • β€’

    Implement proper CORS policies

Monitoring and Maintenance

Deployment Monitoring

  • β€’

    Set up deployment notifications

  • β€’

    Monitor build times and success rates

  • β€’

    Keep track of dependency updates

Performance Monitoring

  • β€’

    Use Cloudflare Analytics

  • β€’

    Monitor page load times

  • β€’

    Track error rates and status codes

Regular Maintenance

  • β€’

    Keep dependencies updated

  • β€’

    Monitor security advisories

  • β€’

    Regular backup procedures


This guide covers the essential steps for deploying your Next.js blog to Cloudflare Pages. Remember that the nodejs_compat flag is crucial for ensuring proper functionality. The deployment process is automated through GitHub integration, making it easy to deploy and redeploy as you update your code.

πŸš€ Pro Tip: Always test your changes locally before pushing to production, and maintain a staging environment for testing major updates.

⚠️ Important: Keep your API keys and sensitive data in environment variables and never commit them to your repository.

Customizing NotionPresso 🎨

πŸ’‘ Want to style your blog your own way? Let's explore how to customize it with CSS and custom components!

1. Styling with CSS

NotionPresso allows easy style changes through CSS variables. Here are the key CSS variables you can modify:

Css
.notion { /* Base Settings */ --notion-font: system-ui, sans-serif; --notion-max-width: 720px; /* Color Variables */ --fg-color: rgb(55, 53, 47); --bg-color: #fff; /* Spacing Settings */ --notion-indent: 27px; }

For more detailed CSS structure and styling guidelines, check out the CSS Structure Documentation!

2. Component Customization

You can customize each Notion block to your liking. Here's an advanced example of customizing the Toggle component, which implements Notion's toggle block:

Typescript
// Toggle Component Customization Example import React, { useState } from "react"; import { Toggle, type ToggleArgs } from "@notionpresso/cli"; import { ChevronDown, ChevronRight } from "{{your-icon-library}}"; const CustomToggle: React.FC<ToggleArgs> = (props) => { const [isOpen, setIsOpen] = useState(false); const handleChangeOpen = (open: boolean) => { setIsOpen(open); // Add additional logic here console.log(`Toggle state changed to: ${open}`); }; return ( <Toggle {...props} isOpen={isOpen} onChangeOpen={handleChangeOpen}> <Toggle.Icon> {isOpen ? <ChevronDown size={20} /> : <ChevronRight size={20} />} </Toggle.Icon> <Toggle.Content>{props.children}</Toggle.Content> </Toggle> ); };

Applying Custom Components

Here's how to use custom components with @notionpresso/react:

Javascript
import { Notion, type NotionPage, type CustomComponents } from '@notionpresso/cli'; import CustomParagraph from './custom-paragraph'; import CustomToggle from './custom-toggle'; const MyNotionPage = ({ pageData }: { pageData: NotionPage }) => { const customComponents = useMemo<CustomComponents>(() => ({ paragraph: CustomParagraph, toggle: CustomToggle, }), []); return ( <Notion custom={customComponents}> <Notion.Cover cover={pageData.cover} /> <Notion.Body> <Notion.Title title={pageData.title} /> <Notion.Blocks blocks={pageData.blocks} /> </Notion.Body> </Notion> ); };

3. Key Customization Points

  1. 1

    Overall Layout

    • β€’

      Adjust maximum width, margins using CSS variables

    • β€’

      Modify responsive breakpoints

    • β€’

      Customize container spacing

  1. 2

    Typography

    • β€’

      Change fonts

    • β€’

      Adjust size scales

    • β€’

      Modify line heights

    • β€’

      Customize heading styles

  1. 3

    Color Scheme

    • β€’

      Define light/dark mode colors

    • β€’

      Create custom theme palettes

    • β€’

      Set accent colors

    • β€’

      Adjust text contrast

  1. 4

    Block Customization

    • β€’

      Style headings

    • β€’

      Format lists

    • β€’

      Design code blocks

    • β€’

      Customize blockquotes

  1. 5

    Responsive Design

    • β€’

      Set mobile-specific styles

    • β€’

      Define tablet breakpoints

    • β€’

      Adjust content flow

Advanced Customization Tips

Theme Management

Typescript
const ThemeProvider = ({ children }) => { const [theme, setTheme] = useState('light'); return ( <div data-theme={theme}> {children} </div> ); };

Custom Block Styles

Css
/* Custom code block styling */ .notion-code-block { border-radius: 8px; padding: 1rem; font-family: 'Fira Code', monospace; } /* Custom blockquote styling */ .notion-blockquote { border-left: 4px solid var(--accent-color); padding-left: 1rem; font-style: italic; }

Responsive Image Handling

Typescript
const ResponsiveImage = ({ src, alt }) => { return ( <div className="notion-image-container"> <img src={src} alt={alt} loading="lazy" className="notion-image" /> </div> ); };

Best Practices

Performance Optimization

  1. 1

    Minimize custom CSS

  1. 2

    Use CSS variables for theme switching

  1. 3

    Implement lazy loading for images

  1. 4

    Optimize component rerenders

Accessibility

  1. 1

    Maintain proper heading hierarchy

  1. 2

    Ensure sufficient color contrast

  1. 3

    Add proper ARIA labels

  1. 4

    Support keyboard navigation

Code Organization

  1. 1

    Keep custom components in separate files

  1. 2

    Use consistent naming conventions

  1. 3

    Document customizations

  1. 4

    Maintain a theme configuration file

Common Pitfalls to Avoid

  1. 1

    Over-customization

    • β€’

      Keep modifications maintainable

    • β€’

      Preserve core functionality

    • β€’

      Document changes thoroughly

  1. 2

    Specificity Issues

    • β€’

      Avoid deep nesting selectors

    • β€’

      Use BEM methodology

    • β€’

      Maintain consistent specificity levels

  1. 3

    Performance Impact

    • β€’

      Monitor bundle size

    • β€’

      Optimize image loading

    • β€’

      Reduce unnecessary rerenders

Testing Your Customizations

  1. 1

    Cross-browser Testing

    • β€’

      Check major browsers

    • β€’

      Test mobile devices

    • β€’

      Verify responsive behavior

  1. 2

    Performance Testing

    • β€’

      Measure load times

    • β€’

      Check bundle size

    • β€’

      Monitor memory usage

  1. 3

    Accessibility Testing

    • β€’

      Use screen readers

    • β€’

      Check keyboard navigation

    • β€’

      Verify color contrast

🎨 Ready to make it your own? Remember to take it step by step and test each change thoroughly!

πŸ’‘ Pro Tip: Start with small changes and gradually build up to more complex customizations as you become familiar with the system.

Congratulations! You're now ready to style your blog in your unique way. πŸŽ‰

Adding Comments to Your Blog with Giscus

Want to add a comment section where visitors can share their thoughts and interact? With Giscus, you can easily implement a commenting system based on GitHub Discussions. This guide will walk you through installing and integrating Giscus into your blog step by step.

Introduction to Giscus

Giscus is a comments system powered by GitHub Discussions. Using Giscus, you can easily add commenting functionality to your blog or website using GitHub accounts for authentication.

You can install the Giscus app to GitHub here.

Installing Giscus

To install Giscus, you need to connect the Giscus app to your GitHub repository. Here are the installation steps:

  1. 1

    Go to the Giscus installation page and click the "Configure" button.

  1. 2

    Set the required permissions.

  1. 3

    Configure access permissions for the repository where Giscus will be used.

Repository Setup

To use Giscus, you need to enable Discussions feature in your repository. Follow these steps:

  1. 1

    Go to your repository settings.

  1. 2

    Enable the "Discussions" feature.

This allows Giscus to use GitHub Discussions functionality.

Configuring Giscus

After installing Giscus, follow these steps to display comments on your website.

You can easily configure this at Giscus configuration page.

Html
// Script example <script src="<https://giscus.app/client.js>" data-repo="notionpresso/nextjs-blog-template" data-repo-id="R_kgDONDy8gg" data-category="Announcements" data-category-id="DIC_kwDONDy8gs4CjpSV" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme" data-lang="en" crossorigin="anonymous" async> </script>

This script should be inserted in the appropriate location on your webpage.

Integrating Giscus with React

In React projects, you can easily add Giscus using the @giscus/react library. Here's how:

Javascript
'use client' import Giscus from "@giscus/react"; export default function Comment() { return ( <Giscus id="comments" repo="notionpresso/nextjs-blog-template" repoId="R_kgDONDy8gg" category="Announcements" categoryId="DIC_kwDONDy8gs4CjpSV" mapping="pathname" strict="0" reactionsEnabled="1" emitMetadata="0" inputPosition="bottom" theme="preferred_color_scheme" lang="en" loading="lazy" /> ) }

Using Giscus in Next.js Projects

  1. 1

    Create a Comment component:

    Typescript
    // components/comment.tsx 'use client' import Giscus from "@giscus/react"; export default function Comment() { return ( <Giscus id="comments" repo="notionpresso/nextjs-blog-template" repoId="R_kgDONDy8gg" category="Announcements" categoryId="DIC_kwDONDy8gs4CjpSV" mapping="pathname" strict="0" reactionsEnabled="1" emitMetadata="0" inputPosition="bottom" theme="preferred_color_scheme" lang="en" loading="lazy" /> ) }
  1. 2

    Add the comment component to your blog post page:

    Javascript
    //app/blog/[slug].tsx import { notFound } from 'next/navigation' import posts from 'content/posts' import NotionRenderer from 'components/notion-renderer' import Comment from 'components/comment' {{existing content remains the same}} export default async function Blog({ params }) { const { slug } = await params let post = posts.find((post) => post.slug === slug) if (!post) { notFound() } return ( <section> // {{content omitted}} <NotionRenderer post={post} /> <Comment /> </section> ) }
  1. 3

    Run npm run dev to check it's working!

Advanced Configuration

Customizing Appearance

Typescript
<Giscus theme="dark_dimmed" // Change theme inputPosition="top" // Move comment box to top lang="en" // Change language />

Handling Theme Changes

Typescript
const [theme, setTheme] = useState('light'); <Giscus theme={theme === 'dark' ? 'dark_dimmed' : 'light'} // other props... />

Custom Styling

Css
.giscus { margin-top: 2rem; padding: 1rem; border-top: 1px solid #eaeaea; }

Best Practices

  1. 1

    Performance

    • β€’

      Use lazy loading

    • β€’

      Place comments at the bottom of the page

    • β€’

      Defer comment loading until needed

  1. 2

    User Experience

    • β€’

      Clear instructions for first-time users

    • β€’

      Proper error handling

    • β€’

      Responsive design support

  1. 3

    Maintenance

    • β€’

      Regular monitoring of discussions

    • β€’

      Prompt response to user comments

    • β€’

      Regular updates of the Giscus package

Troubleshooting

Common Issues

  1. 1

    Comments not loading

    • β€’

      Check repository permissions

    • β€’

      Verify correct repo and category IDs

    • β€’

      Check browser console for errors

  1. 2

    Styling problems

    • β€’

      Theme inconsistencies

    • β€’

      Layout issues

    • β€’

      Mobile responsiveness

  1. 3

    Authentication issues

    • β€’

      GitHub permissions

    • β€’

      CORS errors

    • β€’

      Cookie settings

πŸŽ‰ Congratulations! Your blog now has a fully functional comment system powered by GitHub Discussions!

πŸ’‘ Pro Tip: Regularly engage with your commenters to build a community around your blog.

Remember to moderate discussions and maintain a healthy commenting environment for your blog's community! 🌟

The key to having your blog appear well in search engines lies in proper SEO optimization. This project integrates SEO through robots.txt, sitemap.xml, RSS feed, and metadata configuration.

1. Setting up Google Analytics

For detailed instructions on setting up Google Analytics, please refer to the official tutorial video:

2. SEO Configuration Components

2.1 robots.txt Configuration

The robots.txt file defines rules for search engine crawlers exploring your website. It helps control which pages should be crawled and indexed. This project specifies the sitemap location in the robots.txt file to help search engines understand your site structure.

Typescript
import { baseUrl } from 'app/sitemap' export default function robots() { return { rules: [ { userAgent: '*', }, ], sitemap: `${baseUrl}/sitemap.xml`, } }

This code defines the robots.txt settings, allowing all search engine crawlers access and specifying the sitemap location.

2.2 sitemap.xml Generation

The sitemap.xml file informs search engines about all URLs on your website. It clearly defines your website's structure and helps search engines quickly find and crawl important pages. The sitemap should be updated regularly to include new blog posts automatically.

Typescript
import posts from "content/posts" export const baseUrl = '<https://portfolio-blog-starter.vercel.app>' export async function sitemap() { let blogs = posts.map((post) => ({ url: `${baseUrl}/blog/${post.slug}`, lastModified: post.date, })) let routes = ['', '/blog'].map((route) => ({ url: `${baseUrl}${route}`, lastModified: new Date().toISOString().split('T')[0], })) return [...routes, ...blogs] }

2.3 RSS Feed Implementation

RSS feeds allow users to subscribe to your blog and help search engines quickly detect new content. This project provides RSS functionality for both users and search engines:

Typescript
import { baseUrl } from 'app/sitemap' import posts from 'content/posts' export const runtime = 'edge'; export async function GET() { const itemsXml = posts .sort((a, b) => { if (new Date(a.date) > new Date(b.date)) { return -1 } return 1 }) .map( (post) => `<item> <title>${post.title}</title> <link>${baseUrl}/blog/${post.slug}</link> <description>${post.description}</description> <pubDate>${new Date(post.date).toUTCString()}</pubDate> </item>` ) .join('\\n') const rssFeed = `<?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0"> <channel> <title>My Portfolio</title> <link>${baseUrl}</link> <description>This is my portfolio RSS feed</description> ${itemsXml} </channel> </rss>` return new Response(rssFeed, { headers: { 'Content-Type': 'text/xml', }, }) }

2.4 Metadata Configuration

Page-specific metadata is crucial for SEO. Here's how we set up metadata for each page:

Typescript
export function generateMetadata({ params }) { let post = posts.find((post) => post.slug === params.slug) if (!post) { return } let { title, date: publishedTime, description, image, } = post let ogImage = image ? image : `${baseUrl}/og?title=${encodeURIComponent(title)}` return { title, description, openGraph: { title, description, type: 'article', publishedTime, url: `${baseUrl}/blog/${post.slug}`, images: [ { url: ogImage, }, ], }, twitter: { card: 'summary_large_image', title, description, images: [ogImage], }, } }

Google Search Console is essential for monitoring and improving your site's SEO performance.

  1. 1

    Indexing Status Monitoring

    • β€’

      Track how your site is being indexed

    • β€’

      Identify and fix problematic pages

    • β€’

      Submit new content for indexing

  1. 2

    Search Traffic Analysis

    • β€’

      Monitor search queries leading to your site

    • β€’

      Identify valuable keywords

    • β€’

      Track click-through rates

  1. 3

    Technical Issue Detection

    • β€’

      Identify crawling errors

    • β€’

      Monitor mobile usability

    • β€’

      Track security issues

  1. 4

    SEO Performance Tracking

    • β€’

      Monitor search visibility

    • β€’

      Track click rates

    • β€’

      Analyze search rankings

For detailed setup instructions, watch:

4. SEO Best Practices

Content Optimization

  1. 1

    Use descriptive titles and headings

  1. 2

    Include relevant keywords naturally

  1. 3

    Write compelling meta descriptions

  1. 4

    Optimize image alt texts

Technical Optimization

  1. 1

    Ensure fast page loading

  1. 2

    Implement responsive design

  1. 3

    Use semantic HTML

  1. 4

    Create clean URLs

User Experience

  1. 1

    Optimize mobile experience

  1. 2

    Improve site navigation

  1. 3

    Reduce bounce rates

  1. 4

    Increase page engagement

5. Monitoring and Maintenance

Regular Checks

  1. 1

    Monitor search performance

  1. 2

    Track keyword rankings

  1. 3

    Update content regularly

  1. 4

    Fix broken links

Performance Optimization

  1. 1

    Optimize image sizes

  1. 2

    Minimize code

  1. 3

    Use caching effectively

  1. 4

    Monitor Core Web Vitals

Content Strategy

  1. 1

    Create quality content

  1. 2

    Update existing content

  1. 3

    Target relevant keywords

  1. 4

    Build quality backlinks

πŸ” Pro Tip: Regularly check your Search Console for new insights and optimization opportunities.

πŸ“ˆ Remember: SEO is an ongoing process, not a one-time setup. Keep monitoring and improving!

This comprehensive approach to SEO will help increase your blog's visibility and attract more readers to your content. Remember to regularly check your analytics and search console data to continually improve your site's performance.

Effective Technical Blog Writing: Practical Tips and Know-how πŸš€

Hello, developers starting your blog journey with NotionPresso!

Want to write great posts but not sure where to begin? Don't worry. Here are effective writing tips based on real success stories.

1. The Title is Half the Battle! πŸ“Œ

The first secret of successful posts is the title. Analyzing posts that reached 80K views reveals these title patterns:

  • β€’

    Use emotionally engaging keywords: "Shocking!", "Finally"

  • β€’

    Generate curiosity: "...is possible?"

  • β€’

    Target audience: "If you're a frontend developer..."

  • β€’

    Emphasize practicality: "How to...", "...tips"

Bad Example: "React Component Optimization" Good Example: "The Real Reason Your React Performance Isn't Improving!"

2. Capture Readers with Series πŸ“š

Build reader loyalty through series posts:

  • β€’

    Declare the series: "Chart Library Maker Log #1"

  • β€’

    Preview next posts: "In the next part, we'll cover performance optimization"

  • β€’

    Create connections: Reference and link to previous posts

3. Experience Sharing is Key πŸ’‘

Don't just relay information, share real experiences:

  • β€’

    Include trial and error: "At first, I failed doing it this way"

  • β€’

    Add dramatic elements: "Problem β†’ Consideration β†’ Solution" structure

  • β€’

    Share emotions: "I felt really stuck at this point..."

4. Reader Engagement is Essential! πŸ’¬

Comments and interaction drive blog growth:

  • β€’

    End with questions: "What method do you use?"

  • β€’

    Request opinions: "What do you think about this approach?"

  • β€’

    Suggest future topics: "Let me know in the comments what topics you'd like to see next!"

5. Information Must Be Structured πŸ“‘

Ways to convey complex information easily:

  • β€’

    Step-by-step explanations

  • β€’

    Utilize code blocks

  • β€’

    Visual aids (diagrams, screenshots)

  • β€’

    Emphasize key phrases (bold text, emojis)

Advanced Writing Strategies

Content Planning

  1. 1

    Topic Selection

    • β€’

      Choose relevant topics

    • β€’

      Focus on solving specific problems

    • β€’

      Address common pain points

  1. 2

    Research Phase

    • β€’

      Gather accurate information

    • β€’

      Verify technical details

    • β€’

      Include up-to-date resources

  1. 3

    Content Structure

    • β€’

      Clear introduction

    • β€’

      Logical flow

    • β€’

      Strong conclusion

Writing Process

  1. 1

    First Draft

    • β€’

      Write freely

    • β€’

      Focus on content over style

    • β€’

      Include all technical details

  1. 2

    Revision

    • β€’

      Check technical accuracy

    • β€’

      Improve clarity

    • β€’

      Add examples and illustrations

  1. 3

    Final Polish

    • β€’

      Proofread thoroughly

    • β€’

      Format consistently

    • β€’

      Test all code samples

Technical Writing Best Practices

Code Examples

  1. 1

    Keep it Simple

    • β€’

      Start with basic examples

    • β€’

      Build complexity gradually

    • β€’

      Explain key concepts

  1. 2

    Format Properly

    • β€’

      Use correct syntax highlighting

    • β€’

      Include comments

    • β€’

      Show expected output

  1. 3

    Best Practices

    • β€’

      Follow coding standards

    • β€’

      Include error handling

    • β€’

      Show real-world applications

Visual Elements

  1. 1

    Screenshots

    • β€’

      Clear and focused

    • β€’

      Highlight important parts

    • β€’

      Include captions

  1. 2

    Diagrams

    • β€’

      Simple and clear

    • β€’

      Logical flow

    • β€’

      Proper labeling

  1. 3

    Code Output

    • β€’

      Show expected results

    • β€’

      Include error cases

    • β€’

      Demonstrate success scenarios

Engagement Strategies

Building Community

  1. 1

    Encourage Discussion

    • β€’

      Ask thoughtful questions

    • β€’

      Respond to comments

    • β€’

      Foster healthy debate

  1. 2

    Share Knowledge

    • β€’

      Explain complex topics simply

    • β€’

      Share personal experiences

    • β€’

      Admit and learn from mistakes

  1. 3

    Stay Connected

    • β€’

      Regular posting schedule

    • β€’

      Update old content

    • β€’

      Follow up on discussions

Content Distribution

  1. 1

    Social Media

    • β€’

      Share on relevant platforms

    • β€’

      Use appropriate hashtags

    • β€’

      Engage with responses

  1. 2

    Developer Communities

    • β€’

      Share in relevant forums

    • β€’

      Participate in discussions

    • β€’

      Build genuine connections

  1. 3

    SEO Optimization

    • β€’

      Use relevant keywords

    • β€’

      Write meta descriptions

    • β€’

      Include proper headings

Maintaining Quality

Regular Review

  1. 1

    Content Updates

    • β€’

      Keep information current

    • β€’

      Update outdated examples

    • β€’

      Add new insights

  1. 2

    Technical Accuracy

    • β€’

      Verify code examples

    • β€’

      Update dependencies

    • β€’

      Check for deprecated features

  1. 3

    Reader Feedback

    • β€’

      Address comments

    • β€’

      Incorporate suggestions

    • β€’

      Fix reported issues


Start your journey with NotionPresso now! Don't worry if your first post isn't perfect. You'll naturally develop your own style as you write more. Why not start right now? 🌱

πŸ’‘ Pro Tip: Keep a list of article ideas in Notion to maintain a steady content pipeline.

🎯 Remember: The best technical content combines accuracy with accessibility.

Now you're ready to start creating engaging technical content that provides real value to your readers. Good luck with your blogging journey! πŸš€

Concluding Your NotionPresso Blog Journey

We've now completed our journey of creating your personal blog using Notion and NotionPresso. The ability to write in the familiar Notion environment, customize to your heart's content, and run your blog for free is truly compelling.

What We've Covered

Throughout this guide, we've explored:

  1. 1

    Setting up your development environment

  1. 2

    Understanding project structure

  1. 3

    Connecting with Notion API

  1. 4

    Deploying your blog

  1. 5

    Customizing your space

  1. 6

    Optimizing for search engines

  1. 7

    Building reader engagement

Why This Approach Works

Your blog is more than just a collection of posts. It becomes:

  • β€’

    A platform for documenting your growth

  • β€’

    A space for connecting with others

  • β€’

    A springboard for new opportunities

  • β€’

    A showcase for your expertise

As you move forward with your blog:

Immediate Actions

  1. 1

    Write your first post

  1. 2

    Set up analytics

  1. 3

    Configure comments

  1. 4

    Share with your network

Long-term Goals

  1. 1

    Develop a content strategy

  1. 2

    Build a consistent posting schedule

  1. 3

    Engage with your audience

  1. 4

    Monitor and optimize performance

Technical Maintenance

Remember to:

  • β€’

    Keep dependencies updated

  • β€’

    Monitor performance metrics

  • β€’

    Backup your content regularly

  • β€’

    Stay current with NotionPresso updates

Content Strategy

Consider:

  • β€’

    Creating content series

  • β€’

    Building a content calendar

  • β€’

    Engaging with readers

  • β€’

    Collecting feedback

  • β€’

    Iterating and improving

Growing Your Platform

Focus on:

  • β€’

    Consistent quality

  • β€’

    Regular updates

  • β€’

    Community engagement

  • β€’

    SEO optimization

  • β€’

    Performance monitoring

Final Thoughts

A blog is a journey, not a destination. Each post you write, each reader you connect with, and each improvement you make contributes to your growth as a developer and content creator.

Remember:

  • β€’

    Start small but start today

  • β€’

    Consistency beats perfection

  • β€’

    Engage genuinely with your readers

  • β€’

    Keep learning and improving

  • β€’

    Share your unique perspective

Thank you for joining us on this journey to create your perfect blog with NotionPresso. We can't wait to see what you'll create! πŸŽ‰

πŸ’‘ Pro Tip: The best time to start blogging was yesterday. The second best time is now!

🌱 Remember: Every expert was once a beginner. Your journey starts here.

Now go forth and share your knowledge with the world! πŸš€

Β