Recent chats
ASKGEEZ Q&A GUIDETechnology & devices

How do I mark up a page with more than one main-content candidate?

Quick answer

Choose the one region that contains the page’s dominant content or central application function, and mark that region as <main>. If several regions seem plausible, compare their purpose and specificity to this page; don’t mark every useful section as main. Keep repeated site elements such as navigation, logos, and sidebars outside it unless one of those is itself the page’s main function. A document should not have more than one <main> unless the others are hidden. [S1]

LET’S WORK THROUGH IT

The question, the details, the next step.

Question

My page has an article, a sidebar with related links, and site navigation. They all seem like possible main content. How do I decide what gets marked up?

Geez

Ask which region expresses the page’s central topic or, for an application, its central function. The <main> element represents that dominant content. Its contents should be unique to the document rather than repeated site material such as navigation, sidebars, logos, or copyright information—unless that material is actually the page’s main function. [S1]

For your example, if the page is an article, the article body is the likely candidate. The related-links sidebar supports the article, and the site navigation helps visitors move around; neither becomes main just because it is useful. This is a decision about each region’s role, not its visual size or position.

Follow-up question

What if the article has a title, introduction, several sections, and a conclusion? Should each of those be a separate main region?

Geez

Usually, treat those as parts of the same main content region when they all contribute to the same page topic. Mark the encompassing region as <main>, then keep the article’s internal structure inside it. You do not need to make every important subsection a separate main region.

For example, a page with a site header, article, related-links sidebar, and footer could be organized like this:

<header>
  <nav aria-label="Site">...</nav>
</header>
<main>
  <article>
    <h1>Preparing for a team handoff</h1>
    <p>Introduction...</p>
    <section>
      <h2>What to include</h2>
      <p>...</p>
    </section>
    <p>Conclusion...</p>
  </article>
</main>
<aside>
  <h2>Related guides</h2>
  ...
</aside>
<footer>...</footer>

The ellipses are placeholders, not complete page content. The example illustrates one choice: a single region encloses the page’s central material, while navigation, related links, and the footer remain outside it. The guidance supports the distinction between dominant, unique content and repeated material, but it does not prescribe a particular layout or require this exact arrangement. [S1]

Follow-up question

I have two substantial panels in a dashboard. One shows the current project and the other shows activity. How do I handle two plausible candidates?

Geez

First identify the dashboard’s central function for this page. If one panel carries out or presents that central function and the other is supporting context, use the former as the candidate for <main> and keep the supporting panel separate. If both panels contribute to one central dashboard function, they can both sit inside a single <main>; being separate panels does not by itself mean they need separate main elements.

Write a one-line purpose statement before changing the markup, such as: “This page lets the team review the current project.” Then ask which regions directly serve that purpose and which are repeated site furniture or supporting material. In this hypothetical example, the project panel and activity panel might both belong inside one main region if together they make up the dashboard’s central function. The exact choice depends on the page’s purpose; the guidance does not classify every dashboard panel. [S1]

Follow-up question

How can I check my markup after choosing? I want a simple method I can reuse on other pages.

Geez

Use a short content-first review:

  1. State the page’s central topic or application function in one sentence.
  2. Identify the region that contains the dominant content for that purpose.
  3. Check whether proposed contents are unique to the page or are repeated navigation, branding, sidebar, or footer material. Keep repeated material out unless it is the page’s main function. [S1]
  4. Review the document’s <main> elements. There should not be more than one unless the additional <main> element is hidden. [S1]
  5. Recheck the result if the page purpose changes; a region’s role depends on what that page is for.

A useful note for a code review is: “Main region: [region]. Page purpose: [purpose]. Supporting regions kept outside: [regions].” This records the reasoning without suggesting that every page must use the same layout.

A practical checklist

  • Write the page’s central topic or application function in one sentence.

  • Choose the region containing its dominant content or central function.

  • Keep repeated navigation, logos, sidebars, and copyright material outside unless they are the page’s main function.

  • Put related parts of one central topic inside the same main region when appropriate.

  • Check that the document has no more than one <main> unless additional ones are hidden.

A few more useful answers

Can two separate content panels both belong inside one `<main>`?

Yes, if both contribute to the page’s central topic or application function. The key decision is which region represents the dominant content, not how many visual panels the page has.

Should a related-links sidebar usually be inside `<main>`?

Usually it is supporting material rather than the page’s dominant content. The guidance describes sidebars as repeated material to keep out of the main region unless that material is the page’s main function. [S1]

Does this guidance determine the correct markup for every dashboard?

No. It establishes the role of <main> and the limit on multiple main elements, but it does not classify every dashboard layout. Decide from the actual page purpose and content.

Sources

References used for this guide.

  1. [S1] The HTML main element — MDN
    developer.mozilla.org · Checked

YOUR QUESTION. YOUR DETAILS.

Let’s work through your situation.

Get a tailored answer or help with your next task. Starts at $1, with a quote before you pay.

Ask your own question
← Back to Geez at Work