Skip to content
Norn
Menu

norn-base

The page frame every Norn layout extends: the head, the skip link, norn-header, main, and norn-footer, filled from props. The Norn plugin ships it as an Eleventy layout; use it as layout: norn-base.webc for a WebC page, or extend it from a layout of the project's own. Markdown content is compiled once, so the components the Markdown add-ons write render, also through a Nunjucks or Liquid layout of the project's or a layout alias. Content that is already compiled is inserted as it is, because compiling it again would render its kept component tags twice: a WebC page, a templateEngineOverride with webc, a {% renderTemplate "webc" %} block, a page on a WebC layout of the project's own, and a page on a shipped layout, which sets nornCompiled: true. The nornCompiles helper decides, from page.templateSyntax. A Nunjucks, Liquid, or HTML page renders components through {% renderTemplate "webc" %}. A WebC layout of the project's own deeper in the chain that compiles the content sets nornCompiled: true in its front matter. Props are $data.norn: the plugin's props mapping, or the same-named page data. Every list defaults to []. The head calls norn-head, which declares the cascade layer order first, then embeds the base and print styles: the plugin fills the two style blocks below from css/base.css and css/print.css. A copy of this file pastes their text in. A <section> directly in main is a centered column at --norn-layout-width with block padding and a gap, and its h2 takes the section heading size. The id on the section is the anchor. The rule is in the norn.layout layer under :where(main), so any rule of a project overrides it, and a section anywhere else is left alone. A section is not a landmark: do not name it. Four hooks take markup from fillHooks: head at the end of the head, banner before the header, cta at the end of main, and credit as the footer's last column. The footer's texts ("Licensed under {license}", the navigation's name "Footer") come from componentStrings under norn-base, then English.

layout: norn-base.webc a template, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
---
title: Default
order: 1
layout: norn-base.webc
---
<section>
	<h1>About the project</h1>
	<p>A short line of body text.</p>
</section>
Color scheme
Width

Open on its own

Source
---
title: Sections
order: 2
layout: norn-base.webc
---
<section id="install">
	<h1>Install</h1>
	<p>Install the package from npm.</p>
</section>
<section id="usage">
	<h2>Usage</h2>
	<p>Import the package and call <code>greet</code> with a name.</p>
</section>

Props

The plugin's props mapping sets them on each page, and the layout reads them as $data.norn.

NameTypeDescription
lang string The page language. Falls back to page.lang, then en.
dir string The text direction, set on <html>. Without it, rtl for a right-to-left language (ar, fa, he, ur, ps, yi, dv, ckb, sd, ug, matched on the primary subtag of lang), else ltr. One of ltr, rtl, or auto.
title string The page title. The document title is the title and the name; a page without one shows the name and the tagline.
name string The site name: the brand link, the footer lead, og:site_name.
tagline string A short line after the name.
description string The page description: the meta description and og:description.
url string The canonical URL.
ogTitle string Falls back to the document title.
ogImage { src: string, alt?: string } The share image, or its URL: og:image, og:image:alt, and twitter:card (summary_large_image). A relative src resolves against url, which must then be absolute: with no absolute url, the build logs a norn-head: warning and og:image and og:image:alt are left out. Without an image, no image tag renders. Either way the card is summary.
locale string og:locale, such as en_US.
themeColor string One color for both schemes. Without it, the page surface in each scheme.
themeToggle boolean Apply the scheme a norn-theme-toggle saved, before the first paint.
icon { href: string, type?: string } The favicon, or its URL. Without it the page links an empty icon, so browsers skip /favicon.ico.
touchIcon string A 180px PNG for home screens.
logo { src: string, alt?: string } The brand image, or its URL, in place of the name. The brand link renders only with a logo or a name.
nav { href: string, title: string, icon?: string }[] The header links. icon names a norn-icon.
footer { name?: string, text?: string, license?: { name: string, url: string }, badges?: { href: string, src: string, alt: string, width?: number, height?: number }[], groups?: { heading: string, links: { href: string, title: string }[] }[], colophon?: string } The footer: the lead column (name falls back to the site name, text to the tagline), its badges and license, one navigation of grouped links, and a closing line.

Slots

NameDescription
default The page content, in main, before the cta hook.

Tokens

The global tokens from tokens.json the component reads. Set one in a project's tokens.css to change it everywhere.

Type a value to try it in every example above. Reset puts the default back.

Token Type Default Override
--norn-ui-accentThe brand color, shared by every component. <color> #2346d4
--norn-text-measureLine length for prose. <length> 40em
--norn-font-headingHeading face. Follows the body face until the project sets one. <font-family> var(--norn-font-body, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif)
--norn-font-size-xlSecond-level heading. Larger titles use a clamp. <length> 1.5rem
--norn-space-xsExtra small spacing step. <length> 0.5rem
--norn-space-sSmall spacing step. <length> 0.75rem
--norn-space-mMedium spacing step. <length> 1.25rem
--norn-space-lLarge spacing step. <length> 2rem
--norn-space-xlExtra large spacing step. <length> 4rem
--norn-layout-widthWidth of page content. <length> 64rem