Skip to content
engineering workbench.by StudyPort Academy
Learning path
Foundations16 minLESSON 06 / 16

SEO fundamentals

A crawler reads the document, not a screenshot. It wants a title, text it can select, and a link it can follow. Those are the same strings you already put in the head and the body.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022

The four logs are the document title, the heading, the link target, and the image alt. They were in the HTML before the script ran.

+Go deeper

The title is the result

The title element is the name a search result often shows, and each page should have its own. A meta description, written as meta name=description in the head, is the short summary under that title. It is the same head the document-structure lesson started. One h1 should describe the page topic, and it should agree with the title. The heading, the labels, and the alt text from the last lesson are the same signals a crawler reads.

Text has to be text

Words in an image do not exist as text unless the alt repeats them. and search overlap here because both need the words in the document. A such as h1 gives the words a place in the outline.

An anchor with an href is a link a crawler can follow. A div that looks like a link is not. The words of the link should say where it goes. Click here says nothing about the destination.

What search can read
SourceUseful forInvisible to a crawler
titleThe result nameA heading that exists only as a picture
h1 and paragraphsThe page topicText drawn into a canvas
a hrefA page to visit nextA div styled to look like a link
img altWhat the image isAn empty alt on a meaningful image
meta descriptionThe short summary of the pageA summary that exists only in a picture

Search and access overlap

The last lesson was about announcements. The same missing name hurts both. An image with a real alt helps a screen reader and a crawler. A title helps the tab and the result. You do not write two documents.

View source, not the paint

If view source does not contain the title, the heading, the sentence, and the href, the crawler does not have them either. The script prints four of those strings so you can see they came from elements.

04

Guided challenge

SEO fundamentals

The description of the image is the alt attribute, not title. Read alt so the last log is Two gulls above the harbor.

Opening editor…
LIVE PREVIEW
Console 0

Your console output appears here.

Saved on this deviceJavaScript · ES2022

EXPECTED CONSOLE OUTPUT

Harbor birds
Harbor birds
#gulls
Two gulls above the harbor

Hints 0/2

    Use all hints or make 3 failed runs (0/3).

    05

    Free sandbox

    Edit the HTML and CSS. The JavaScript tab can read the result. This draft is saved separately.

    Opening editor…
    LIVE PREVIEW
    Console 0

    Your console output appears here.

    Saved on this deviceJavaScript · ES2022
    06

    Quiz

    A quick check for understanding. Retry as often as you like; your learning path stays open.

    01Which element usually names the search result?
    02Why does alt text help search?

    Ready to call this one understood?

    Mark this lesson complete to earn 100 XP. You can always revisit it.

    Sign in to save progress
    Next lesson