Help Center

Astro / Getting started

Edit text and pages

Change text, add pages and update the menu of your Viralistic Astro site safely, with a preview before anything goes live.

Beginner 10 min Updated

This article is for site owners and editors who want to change their own website without waiting for a developer. On a Viralistic Astro site, all text lives in plain files, so editing a page means editing a file. You will learn how a page file is built, how to edit it in the browser on GitHub, and how to check your change before it goes live.

How a page file is built

Every page is a markdown file in src/content/pages. It has two parts:

---
type: page
title: Privacy policy
description: How we handle personal data and the rights you have.
eyebrow: Privacy
intro: We keep personal data to the minimum needed to run this website.
seo:
  title: "Privacy policy | Your Company"
  description: "How we handle personal data and your rights under the GDPR."
---

## Who is responsible

Your Company, Example Street 1, Amsterdam, is responsible for the data on this page.
  • Frontmatter is everything between the two --- lines. It holds structured data in YAML: the page type, title, description, buttons, images. The layout decides where each field appears.
  • Body is everything below. It is long-form text in markdown: headings, paragraphs, lists and links.

The fields you may use depend on the type. Copy an existing page of the same type when in doubt.

Edit a page on GitHub

You do not need to install anything for small text changes.

  1. Open the website’s repository on GitHub and go to src/content/pages.
  2. Open the file for the page you want to change. The file path matches the URL: /webdesign/hosting lives in webdesign/hosting.md.
  3. Click the pencil icon to edit the file.
  4. Make your change.
  5. Click the button to commit your changes, and choose to create a new branch and start a pull request.
  6. Open the pull request. After a minute or two, Netlify adds a link to a deploy preview.
  7. Open the preview and check the page.
  8. When it looks right, merge the pull request. The live site updates automatically.

Tip: Working through a pull request means nothing reaches your visitors until you have seen the preview. If the build fails, the live site stays as it was.

YAML rules that prevent errors

Most failed builds after a content edit come from one of these:

  • Indentation uses spaces, never tabs. Nested fields (such as title under seo) are indented two spaces.
  • Quote text that contains a colon. title: "SilverDrive: a premium chauffeur brand" works. Without quotes, YAML gets confused.
  • List items start with a dash and a space. Each button or feature is one - item with its fields indented below it.
  • Do not invent fields. The schemas are strict, so an unknown field (or a typo such as tilte) stops the build with an error naming the file and the field.
  • Do not remove required fields. Every page needs at least type, title and description.

Write the body text

The body uses ordinary markdown:

## A section heading

A paragraph of text with a [link to the contact page](/contact) and **bold words**.

- A list item
- Another list item

Start sections with ##. The page title is already shown at the top of the page, so do not add a # heading yourself.

The navigation, the main call to action and the footer links are shared by every page. They live in one file: src/content/globals/nl.yaml.

navigation:
  - label: About
    href: /about
  - label: Contact
    href: /contact
cta:
  label: Strategic call
  href: https://calendly.com/marrallisa/30min

Add, remove or reorder items here, and every page updates.

Add a new page

  1. Find an existing page that looks like the one you want, for example another service page.
  2. Copy its file and give the copy a new name. The name becomes the URL, so use lowercase words separated by hyphens: brand-photography.md.
  3. Change the title, description and the rest of the content.
  4. Link to the new page from the menu or from another page, so visitors and search engines can find it.
  5. Commit through a pull request and check the deploy preview.

Note: Renaming or deleting a page changes or removes its URL. Add a redirect from the old address so you keep its visitors and rankings. See Keep your rankings when you relaunch.

Next steps

Still stuck?

Send us what you tried and a screenshot, and we will help you further. For new projects, book a strategic call.