Repository navigation
Theming
A Wren theme is one HTML file named theme.html placed beside
index.php. Delete the file and the built-in theme returns — that is the
entire risk model of experimenting.
Write plain HTML and CSS, and place these where you want things to appear:
{{site_title}} {{tagline}} {{page_title}} (title · site, for <title>)
{{menu}} {{content}} {{home_url}} {{rss_url}} {{year}}
{{generator}}
That is the whole template language. No PHP in the theme, no build step.
Optionally add {{seo_head}} inside <head> to control where the SEO tags
land; omit it and they are injected automatically.
Since 1.7.0, two more kinds of tag are available:
-
{{url:privacy}}gives the address of the page with that slug, written correctly whether Pretty URLs are on or off. Use it for footer links such as a privacy notice or contact page. -
[[phone]],[[email]]and similar show a business detail from Settings. These exist once a starter pack has been installed;[[phone_link]]gives the phone number without spaces, ready for atel:link. A tag with no matching detail shows nothing.
<a href="tel:[[phone_link]]">[[phone]]</a>
<a href="{{url:privacy}}">Privacy notice</a><!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{page_title}}</title>
<style>
body { max-width: 42rem; margin: 2rem auto; padding: 0 1rem;
font: 17px/1.65 Georgia, serif; }
nav a { margin-right: 1rem; }
.post-meta { color: #888; font-size: .8rem; text-transform: uppercase; }
</style>
</head>
<body>
<h1><a href="{{home_url}}">{{site_title}}</a></h1>
<p>{{tagline}}</p>
<nav>{{menu}}</nav>
{{content}}
<footer><p>© {{year}} · <a href="{{rss_url}}">RSS</a></p></footer>
</body>
</html>Most themes print the site name as text. To show a logo instead, upload the
image in the admin's Media tab, then swap the tag for an <img> in your
theme.html. Where the theme has something like this:
<a href="{{home_url}}">{{site_title}}</a>use this instead:
<a class="logo" href="{{home_url}}">
<img src="/media/logo.png" alt="{{site_title}}">
</a>Two details make that line worth copying exactly. Keeping the link to
{{home_url}} preserves the convention that clicking the logo goes home. And
putting {{site_title}} in the alt attribute means screen readers and search
engines still get your site's name — Wren substitutes tags anywhere in the
file, including inside attributes — so you lose nothing by replacing the text.
Then size it with CSS rather than in the image tag, so it stays sharp on high-resolution screens:
<style>
.logo img { display: block; height: 48px; width: auto; }
@media (max-width: 640px) { .logo img { height: 36px; } }
</style>Upload the image at roughly twice the height you intend to display — a logo shown at 48px looks best from a file around 96px tall — and the browser will scale it down crisply on retina displays.
Keep {{page_title}} in the <head>. That tag fills the browser tab and
search results, and has nothing to do with the visible header; removing the
visible site name does not remove the need for it.
If your logo is an SVG, you can skip the upload entirely and paste the SVG code
straight into theme.html where the title was. It costs no extra request, scales
perfectly at any size, and can be recoloured in CSS — though the file gets
longer and harder to skim, which is the trade-off.
Content arrives marked up with stable classes. Articles and pages use
post-title, post-meta, post-body, more (the read-on link), and
pagination. The menu marks the current item with active; submenu parents
are wrapped in menu-sub (plus active-branch when the current page is
inside), dropdowns are menu-drop, and heading-only labels are menu-label —
override those three to restyle dropdowns. Comments use comments, comment,
comment-form, and comment-notice.
Define your palette as CSS variables at the top of the file so retuning
colours later is a five-second job. Style the content classes so your
typography reaches inside articles. And remember themes are per-site: one
theme.html, no options panel — if you want the site to look different, you
edit an HTML file.
Start here
Using Wren
Under the hood
Keeping it running
Wren Shop - Installation & Setup