Skip to content
New: Customize your theme with an AI assistant. Read the guide

Customizing Layouts

Files: src/pages/[...lang]/, src/content/sections/<language>/, src/layouts/components/sections/ · Skill level: Beginner

Every page is made of sections. Each section has a content file for its text and options, and a component file for how it looks:

  • Content files (Markdown): src/content/sections/<language>/, with one folder per language, such as english/, french/, and arabic/.
  • Component files: src/layouts/components/sections/.

The sections differ by theme, so open your theme’s files to see which it has.

Find A Section

Open the page’s route file to see which sections it uses, and in which order. The homepage is src/pages/[...lang]/index.astro, and other pages have their own file in the same folder:

<Base {...homepage?.data} homepage={true}>
<SectionOne />
<SectionTwo content={homepage?.data.sectionTwo} />
</Base>

<SectionOne /> is the component src/layouts/components/sections/SectionOne.astro. Its content file usually has a similar name in src/content/sections/<language>/, and the top of the component shows which file it reads.

Change A Section In Its Content File

Open the section’s Markdown file. The settings between the --- lines control its text and options. Many sections have an enable field, and parts of a section can have their own:

---
enable: true # Set to false to hide this section
title: "Your section title"
---

Make the same change in every language’s file. A section’s content file is shared, so the change applies on every page that shows the section.

In the Tina edition, you edit this under Section defaults at /admin/. In the Sanity edition, you edit the section’s document in the Studio. If a page has its own block for the section, that block changes the section on that page only.

Change A Section In Its Component File

This is for developers. Open the component in src/layouts/components/sections/, and edit or remove the markup you don’t need. The change applies everywhere the section is used, in every language. Use logical CSS classes such as ms-* and text-start, so the section still works in right-to-left languages. See RTL & Arabic.

Do It With AI

On the [PAGE] page, hide [PART] of the [SECTION] section. Find the section in the route file in
src/pages/[...lang]/, then its content file in src/content/sections/. Use an existing enable field
if there is one, and make the change in every language. Change the component only if there is no
option for it. Then run npm run astro-check.
Type something to search...