Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

Link Relations

How the rel attribute says what a link is for, which values Vanilla Breeze styles, and what it does to links that open a new tab.

Say what the link is for

The rel attribute on a link names its relationship to the current page: it leads off the site, it is the next chapter, it is the license, it is a topic. HTML already defines these words. Vanilla Breeze styles several of them, so a link that states its purpose needs no class to look the part.

Values with a style

ValueMeaningStyle
externalThe destination is on another siteA trailing ↗
tagA topic that applies to this pageA pill outline
prevThe previous page in a seriesA leading ←
nextThe next page in a seriesA trailing →
helpHelp for this page or controlA dotted underline
license, privacy-policy, terms-of-serviceLegal pagesSlightly smaller and fainter

The arrows are decoration. They are given empty alternative text, so a screen reader reads the link text alone.

Where the arrows do not appear

Inside <nav>, <header> and <footer> the external, prev and next arrows are turned off, because a navigation bar full of arrows is noise. A previous and next pair inside a <nav> therefore shows no arrows. If you want them, put the pair in a <p> or a layout element, as the demo does, or add the arrows yourself with <icon-wc>.

The pill, the dotted underline and the fainter legal links apply everywhere.

External links without rel

A link whose href starts with http or // gets the same ↗ without any rel. Downloads, mailto:, tel: and PDF links get their own marks the same way. Add rel="external" when the address alone does not show that the link leaves the site, such as a redirect path on your own domain, or when you want other tools to know. A link with both gets one arrow. Add data-no-icon to a link to remove its mark.

Values without a style

These carry meaning for browsers, search engines and your own selectors. The library gives them no look.

ValueMeaning
nofollowDo not treat the link as an endorsement
authorA page about the author. In the <head>, <link rel="author"> is read by <page-info>.
meAnother page that represents the same person
bookmarkA permanent link to the nearest <article>
searchA search page for this site
alternateAnother form of this page. Pair it with hreflang for a translation or type for another format.

Use ~= in the selector. rel is a list of words, and [rel="tag"] would miss rel="tag nofollow".

Links that open a new tab

A page opened with target="_blank" can reach back to the page that opened it unless the link says noopener. When a page contains such a link, the library loads a small module that adds rel="noopener" to every <a target="_blank"> that does not already state a policy with opener, noopener or noreferrer. Press the button in the demo above to read the attribute it added.

  • Write rel="opener" on a link that needs the connection, and it is left alone.
  • Links in the page when the module loads are changed at once. A link added later gets the attribute when the reader activates it, by click, keyboard or middle click, before the browser follows it.
  • Current browsers already treat target="_blank" as noopener. The attribute makes the policy explicit in the markup.

Hiding the referrer

Set data-link-privacy="strict" on <html> and the same pass also adds noreferrer to every new-tab link, so the destination is not told which page the reader came from. It is off by default because referral reports and affiliate links depend on that header.

Choosing between rel, class and data attributes

You want to sayUseExample
What the link is, in relation to this page rel, with a value HTML defines rel="next"
How the link should look data-variant or a class data-variant="muted", data-variant="plain"
Something your own scripts need A data-* attribute data-track="pricing-click"

Do not invent rel values for styling or tracking. Other tools read rel and expect its words to mean what the standard says.

Finding links by purpose

Because the purpose is in the markup, a script can collect links by it with a selector. No helper is needed.

↑