This article is part of a series about building my personal website:

  1. The idea and choosing the right tool
  2. SEO essentials: meta tags and base head element
  3. Content management with Markdown and Frontmatter
  4. Semantic HTML for accessibility and external readers
  5. Minimalist CSS: styling and native-like design
  6. Adding color themes with JavaScript
  7. Astro plugins: RSS, Sitemap, Word count
  8. SVG icons and Favicon
  9. Building resume with XeLaTeX
  10. Extras

When building a website, semantic HTML should be the backbone of your markup. It’s not just about making things look good — it’s about ensuring the content is understandable, accessible, and well-structured for both humans and machines.

Let’s focus on the <body> structure and see how proper semantics improve accessibility, SEO, and maintainability.

Why semantic HTML matters

Semantic HTML benefits:

HTML has a rich set of elements, each with its own meaning. While <div> and <span> have their place, they carry no semantic value on their own. Before writing markup, ask yourself: “What’s the most appropriate HTML tag for this content?”

For example, my general page structure looks like this:

<body>
  <header>
    <nav></nav>
  </header>
  <main></main>
  <footer></footer>
</body>

This clear layout helps screen readers navigate quickly and preserves the document’s outline even without CSS. For more element examples, see W3Schools’ semantic elements guide.

Structuring blog posts

Each blog post (and even its preview on listing pages) is wrapped in an <article> tag. Inside, I include:

Example structure:

<article>
  <header>
    <h1>Article Title</h1>
    <dl>
      <div>
        <dt>Published on</dt>
        <dd><time datetime="2025-07-30">July 30, 2025</time></dd>
      </div>
      <div>
        <dt>Reading time</dt>
        <dd>2 min read</dd>
      </div>
    </dl>
  </header>
  <!-- Content -->
</article>

This not only helps accessibility tools but also makes your HTML self-explanatory for future you (or other developers).


Accessibility enhancements I made

Accessibility is not a “one-and-done” step — it’s an ongoing process. Here’s what I added:

You can run tools like Unlighthouse to scan all your pages for accessibility issues at once.