Docs: Upgrading from 1.20

Upgrading from 1.20

What a theme forked before Tilspire 1.21.0 should change, what stays hidden until you place it, and what is new.

Tilspire 1.21.0 is additive: a theme that changes nothing keeps working. A few habits now cost something, and some parts stay hidden until you place them. If your theme was forked earlier than 1.20.0, read the 1.19 notes and the older ones as well; each release lists only what changed since the one below it.

Habits that now cost something #

  • It loads blog-share.js by its path. The Blog's share script is gone, so the address answers 404. The share row is now core's share component. Remove the line.
  • It sets no --cms-accent. The share row takes its colour from it. Without it the row is blue, where the Blog's was green. Set it to your accent colour.
  • It has a comments-form view of its own that leaves out $restriction. A member who is restricted from commenting is then told nothing. Draw it with the restriction-notice component.
  • It has an auth-account view of its own that escapes where and reason. In $restrictions both arrive already escaped, with <bdi> around them. Escape them a second time and readers see the markup.
  • It draws Forums or comments from its own views and leaves out images. Pictures on a forum post or comment then do not show.
  • It prints a full date in title. Use data-tooltip, as timeTag() now does.

What stays hidden, or is drawn for you, until you place it #

These break nothing.

  • Direct messages. The message-envelope component, beside the bell, and messageButton() show only where your templates place them.
  • The Share row. While pageShare() is unclaimed, core's page-share draws it at the end of a page, just before the footer. Call pageShare() or place the component to put it where you want it.
  • The privacy policy addition. Core's page-policy draws it last in <main> until pagePolicy() or the component claims it.
  • Online status. The dot shows only where a view asks for it with viewerSeesPresence() and a presence_id on person-avatar.
  • Badges. Forums' forums-awards component draws the badges beside a name in a post, and core's member-profile view draws the badges card. A theme that does nothing gets both.
  • The rules page. Core's views/rules.php draws /rules while your theme ships none.
  • The rules link in the footer. Core adds it before the last </footer> until you call rulesLink('footer') where you want it.

Checklist #

Work down it once, search your theme's folder for each pattern, and change what you find.

  1. Share script. Search for blog-share.js and remove each line that loads it. The old blog-share classes stay beside the new cms-share* ones.
  2. Accent. Set --cms-accent to your accent colour.
  3. Comment form. In your own comments-form view, draw $restriction through the restriction-notice component. To take pictures, draw pictures-field with form.images as max, only while it is above 0, and send the form as multipart/form-data.
  4. Restrictions in the account page. In your own auth-account, print each restriction's where and reason as they are, and give the section the id restrictions.
  5. Pictures. In your own comment list or Forums view, print each item's images after its body, with both addresses escaped, or hand them to the pictures component. Print t('images.failed') when images_failed is true.
  6. Dates. Search for title= on a date. Move the full date to data-tooltip.
  7. Messages. Place the message-envelope component beside the bell, and scope your CSS for it to the header, for example .site-header .dm-envelope.
  8. Signature. If a file of yours replaces the slot account-profile-extra, draw the slot, or members cannot edit their signature.
  9. Version. Raise version in theme.json on every shipped change.
  10. Check. Load the site as a guest and as a signed-in member. Open a post with the Share row on, a comment form as a restricted member, the community rules page and the account page. Then check the Health page for warnings about your theme.

New in 1.21.0 #

These are additive, and each is optional.

  • Share. pageShare() gives {title, url, path, links, script} for the share component. It is null unless Share is on in Pages ▸ Settings and on the page, and the page is published. See Other pages and menus.
  • Privacy policy addition. pagePolicy() lists the site's addition to the privacy policy, for the page-policy component.
  • Online status and messages. viewerSeesPresence(), messageButton() and the messages_* keys of visitor(). See The site, the visitor and the request.
  • Restrictions. restrictionNotice() and the restriction-notice component.
  • Community rules. rules(), rulesLink() and rulesAccept(). See Sign-in, forms and consent.
  • Pictures. images on comments, form.images and the pictures and pictures-field components. See Search, comments and previews.
  • Reports and actions. report() gains rules, and three actions are new: forums.post.restrict, core.member.ban and core.member.restrict. See Actions and sections.
  • Tokens. --cms-online, --cms-accent, --fx-award-tip-radius, --fx-award-tip-bg, --fx-award-tip-ink and --cms-target-bg, which marks a rule you jumped to. Each has a fallback.
  • Dates. timeTag() keeps the full date in data-tooltip. The new clock style is a site setting, so your theme draws nothing extra.

The theme guide, site/themes/README.md, in every copy of Tilspire, describes every 1.21.0 call under "Upgrading an older theme" and in the Template API's tables. Both shipped themes are already updated.