Free HTML course. Sign Up for tracking progress →

HTML: Semantic Web

With the increase in the number of pages on the Internet, reading information has become a problem not just for humans, but also for bots. While a human can separate meaningful blocks from each other, see the arrangement, and quickly find the part of the page they need, a bot sees the entire page as text and can't break it down on its own to analyze the meaning of the information.

This problem became prominent at the beginning of the millennium when the number of pages on the Internet started to steadily increase and search engines (Google, Bing, Yandex, Yahoo) had little ability to analyze each page on the Internet properly. Because of this, webmasters deliberately added popular (at the time) keywords to get a higher position in search results.

Now you can tell the bots the meaning (semantics) of an HTML page. Thanks to this, when you make a query in a search engine, you can see not only a list of links to sites, but also specific information, such as a recipe for a pie, the route to the desired street, or the contact details for an organization.

The right semantics also allow devices to perceive parts of the website correctly. For example, reading mode on phones tries to discard unrelated blocks of content to leave only the meaningful part.

Standard lesson view on Code Basics and reading mode

There are two implementations of the semantic web:

  • Micromarking-based. These are special attributes that are added to the HTML markup to help bots find the right information. Micromarking is the method used most often, as it has lots of possibilities and fields for markup

  • HTML5-based. There are many tags in the standard that help bots analyze information, find logical connections between blocks (or realize that they don't exist), and find the parts needed to show the website correctly on reading devices

Although HTML5 has not superseded micromarking because since it's less capable, using it in conjunction with micromarking allows bots to process the site more correctly and find logical blocks in it.

An example of semantic markup in HTML5

<main> <!-- Determining the main part of the page -->
  <article> <!-- Determining the article -->
    <header> <!-- Title information for the article -->
      <h1>Article title</h1>
      <img src="article.png" alt="article name">
    </header>

    <p>Our text</p>

    <footer> <!-- Article footer with author and date -->
      <address> <!-- Information about the author of the article -->
        <p>Author: Damian</p>
        <p>Email: damian@test.test</p>
      </address>
      <time datetime="2019-07-27">27 July</time> <!-- Publication date -->
    </footer>
  </article>
</main>

Instructions

Create an article markup like the example above. The data inside can be anything

The exercise doesn't pass checking. What to do? 😶

If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:

  • Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
In my environment the code works, but not here 🤨

Tests are designed so that they test the solution in different ways and against different data. Often the solution works with one kind of input data but doesn't work with others. Check the «Tests» tab to figure this out, you can find hints at the error output.

My code is different from the teacher's one 🤔

It's fine. 🙆 One task in programming can be solved in many different ways. If your code passed all tests, it complies with the task conditions.

In some rare cases, the solution may be adjusted to the tests, but this can be seen immediately.

I've read the lessons but nothing is clear 🙄

It's hard to make educational materials that will suit everyone. We do our best but there is always something to improve. If you see a material that is not clear to you, describe the problem in “Discussions”. It will be great if you'll write unclear points in the question form. Usually, we need a few days for corrections.

By the way, you can participate in courses improvement. There is a link below to the lessons course code which you can edit right in your browser.

If you got stuck and don't know what to do, you can ask a question in our huge and friendly community