How to edit your own Next.js website without breaking it

Where every word and image on a Next.js site actually lives, how to change it right on GitHub, and how to check it before anyone else sees it.

Londynn Metten

· 7 min read

You’ll end up with

A text, image or page-title change live on your site, checked on a preview first

Time
15 minutes a change
Cost
Free
Level
Beginner

The short answer

To edit a Next.js site, find the file that holds the words or image you want to change (pages live in the app folder, sections in components, images in public), edit it right on GitHub, and save it to a new branch instead of main. Your host builds a preview link for that branch, so you can check the change on your phone before it goes live. When it looks right, merge it and the live site updates in a minute or two. Change the words between the tags and leave the code around them alone.

01

Where does everything live in a Next.js site?

A Next.js site looks like a lot of files the first time you open it. You’ll only ever touch a handful. Here’s the map for a typical site, including the ones v0 builds.

What you want to changeWhere it usually lives
The home pageapp/page.tsx
Another page, like /aboutapp/about/page.tsx (the folder name is the web address)
A section used on several pagescomponents/, for example components/hero.tsx or components/footer.tsx
Images, logos, the faviconpublic/, for example public/images/team.jpg
Site-wide title, fonts, header and footerapp/layout.tsx
Colors and spacingapp/globals.css
Settings you shouldn’t need to touchnext.config.mjs, package.json
Folder names vary a little from site to site. The pattern doesn’t.

The one idea to hold onto: in the app folder, folders are web addresses. app/services/page.tsx is the page at yoursite.com/services.

  • app/page.tsxyoursite.com/
  • app/about/page.tsxyoursite.com/about
  • app/services/page.tsxyoursite.com/services
  • app/services/catering/page.tsxyoursite.com/services/catering
Each folder is a page of your site. The folder’s name is the page’s web address.
02

How do you find the exact words you want to change?

Don’t hunt through folders. Search for them. Copy a short, unusual phrase from the live page, something like “Open Tuesday to Saturday”, and paste it into the search box at the top of your repository on GitHub.

GitHub shows every file containing that phrase. Nine times out of ten there’s one result, and that’s your file. If a phrase isn’t found, try a shorter piece of it. Long sentences are sometimes split across lines in the code.

03

What is safe to change, and what should you leave alone?

Open the file and you’ll see your words wrapped in code. Here’s what a typical section looks like.

Abc Change freely/abc Careful: keep the quotes<abc> Leave alone
<section className="py-24">  <h2 className="text-4xl">    Open Tuesday to Saturday  </h2>  <p className="text-lg">    Walk-ins welcome. Call ahead    for groups of six or more.  </p>  <a href="/contact">    Book a table  </a></section>
The same section, marked up: highlighted words are yours to change, the faded code is not.
  • Safe: the words between tags, like “Open Tuesday to Saturday” or “Book a table”.
  • Safe, carefully: what’s inside quotes after href= (where a button goes) or alt= (an image description). Keep both quote marks.
  • Leave alone: className=, curly braces { }, and anything that looks like a word joined to another word with a dot.
  • If your sentence has an apostrophe and the build complains, use the curly one (’) instead of the straight one.
04

How do you edit a file right on GitHub?

  1. 01Open the file on GitHub and click the pencil icon at the top right of the file.
  2. 02Make your change. Only the words.
  3. 03Click Commit changes. In the box that opens, write a short note like “Update opening hours”.
  4. 04Choose “Create a new branch for this commit and start a pull request”, then click Propose changes, then Create pull request.
  5. 05Wait a minute or two. Your host posts a preview link on the pull request. Open it on your phone and on your computer.
  6. 06If it looks right, click Merge pull request. The live site updates on its own a minute or two later.
Commit changes

Commit message1

Update opening hours
Commit directly to the main branch
Create a new branch for this commit and start a pull request2
CancelPropose changes3

Simplified drawing · real wording may differ slightly

  1. 1Say what you changed, in plain words. Future you reads this.
  2. 2Pick the branch option. Main is the live site; a branch is a draft.
  3. 3Propose, then Create pull request. Your host posts a preview link on it.
The one screen that matters: save to a new draft (a branch), not straight to the live site.

Committing straight to main skips the preview and goes live immediately. It’s fine for fixing a typo. For anything else, use a branch.

If you merge something and then spot a mistake, it’s two clicks to reverse. That’s covered in how to undo a bad change.

05

How do you swap an image?

  1. 01Make the new image a sensible size first. A photo for a web page should be about 2000 pixels wide at most, and ideally under 500 KB. WebP or JPG both work.
  2. 02The easy way: give the new file exactly the same name as the old one. In the public folder on GitHub, click Add file, then Upload files, and drop it in. Same name means the code doesn’t change at all.
  3. 03The other way: upload it with a new name, then search the code for the old file name and change it to the new one.
  4. 04Update the alt text next to it so it describes the new picture. That’s what screen readers and search engines read.
06

How do you change the title Google shows?

Each page can say what title and description it wants in search results. Look near the top of that page’s page.tsx for a block called metadata. If a page doesn’t have one, it uses the site-wide one in app/layout.tsx.

export const metadata = {
  title: "Wood-fired pizza in Mount Shasta",
  description: "Open Tuesday to Saturday. Walk-ins welcome, groups call ahead.",
}
Keep titles under about 60 characters and descriptions under about 160, or Google cuts them off.

While you’re in there, check that the site’s main address is your real domain and not your host’s preview address. If it’s wrong, Google indexes the wrong one. Here’s why Google indexes the wrong domain and the five-minute fix.

07

How do you add a new page?

Copy a page that already looks close to what you want. If you want a /services page that looks like /about, create a new file at app/services/page.tsx, paste in everything from app/about/page.tsx, and change the words.

Then add a link to it wherever your menu lives, usually a header file in components. Search your repository for an existing menu label like “About” to find it.

08

When should you edit on your own computer instead?

GitHub’s editor is great for one file at a time. When a change touches several files, or you want to see it instantly as you type, run the site on your own computer.

git clone <repo-url>
cd <repo-folder>
npm install
npm run dev
Then open http://localhost:3000. If the repo has a pnpm-lock.yaml file, use pnpm instead of npm.

Or skip the typing altogether and hand bigger edits to an AI assistant that works on the files for you. That’s part five: editing your site with Claude, ChatGPT or Grok.

09

When an edit is bigger than it looks

Words, images, titles and links are all safe to do yourself. Layout is where it gets harder. Moving a section, changing how something looks on a phone, or adding a form touches the code around the words, and that’s where a small slip breaks the build.

If the preview fails to build, nothing reaches the live site. Read the first error in the build log, undo your last change, and try again, or paste the error into an AI assistant and ask what it means. A failed preview is a warning, not a disaster.

Common questions

Do I need to install anything to edit my Next.js site?
No. GitHub’s website lets you edit any file in the browser, and your host builds a preview for every branch. You only need a code editor and Node on your computer if you want to run the site locally.
What is a .tsx file?
It’s a page or section of your site written in TypeScript and JSX, which mixes code with something that looks a lot like HTML. You can treat it like HTML: words between tags are content, everything in angle brackets is structure.
Will editing a file on GitHub change my live site straight away?
Only if you commit to main. Commit to a new branch instead and open a pull request. Your host builds a preview from that branch, and the live site changes only when you merge.
How long until my change shows up on the live site?
Usually one to three minutes after you merge, while the host rebuilds the site. If it still looks old, refresh with a hard reload, since your browser may be showing a cached copy.
Can I edit a v0 site this way after I stop using v0?
Yes. That’s the point. Once the code is on GitHub, it’s a normal Next.js site and you edit it like any other. Just don’t go back to the builder afterwards, or you’ll be editing two different versions.

Keep going

More you can build yourself

Up next · Part 4

How to deploy your Next.js site from GitHub to Cloudflare or Vercel, step by step

About 45 minutesBeginner

Build it yourself

How to ship a one-page website with Claude, v0, and GitHub in 90 minutes

About 90 minutesBeginner

Playbook · Part 5

How to edit your website with Claude, ChatGPT or Grok, with prompts you can copy

10 minutes an editBeginner

Playbook · Part 2

What are Git and GitHub, and why does your website need them?

About 30 minutesBeginner

Playbook · Part 1

How to leave WordPress for a site you actually own

1 to 3 daysBeginner

Build it yourself

How to write one prompt that gets a usable answer on the first try

About 10 minutesBeginner

Build it yourself

How to get on Google Maps, then actually get reviews

About 1 hourBeginner

Build it yourself

How to build a brand kit you can actually reuse

About 2 hoursBeginner

Build it yourself

How to run your AI assistant in the terminal, where it can see your actual files

20 minutes to set upIntermediate

Build it yourself

How to turn a workflow you keep repeating into an AI skill that fires on its own

About 1 hourIntermediate

Fix what broke

How to tell if your contact form is silently dropping leads

About 30 minutesBeginner

Fix what broke

Why scroll animations hide content from some visitors

About 15 minutesAdvanced

Fix what broke

Why Google is indexing the wrong domain for your site

About 20 minutesIntermediate

Your edits need somewhere to go live. Part four: deploying from GitHub to Cloudflare or Vercel, step by step.

Read part 4