How to change the /blog URL path

Read time: 1 minute
Mitchell Christ
Mitchell Christ
top-down aerial drone view of LAX runway with the text "/ BLOG" (forward slash), IMAX 70mm

Creating a website with a blog is effortless with SanityPress. Out of the box, the blog homepage and individual posts are organized under the /blog URL path.

But what if "blog" doesn’t align with your vision? No problem—customizing it to fit your needs is a breeze with a few tweaks to your SanityPress codebase.

In this guide, we’ll walk you through the steps to update the blog’s URL path. For this example, we’ll show you how to change /blog to /press. Let’s dive in!

1 File to update:

src/lib/env.ts
  • // line 14
    - export const BLOG_DIR = 'blog'
    + export const BLOG_DIR = 'press'

    1 Folder name to update:

    Lastly, we want to change the folder name that handles the Next.js routing for the blog pages:

  • - src/app/(frontend)/blog/*
    + src/app/(frontend)/press/*

    Let us know below if you'd like further refinements!

    Lombard Street in San Francisco, a wavy street between a neighborhood with bushes and flowers, street sign with the text "Blog Path", cityscape of San Franscisco in the distant background, IMAX 70mm