Publican v0.8.0 update

By Craig Buckler

(updated )

963 words, 5-minute read

root
Image courtesy of Eilis Garvey

Publican v0.8.0 was released on .

There were no breaking changes, but the following features were added.

Alternative index filenames #

By default, Publican uses content slugs ending in index.html to create friendlier directory-based URLs. Content at blog/index.md renders to the slug blog/index.html.

You can choose an alternative index filename if necessary:

publican.config.js excerpt

// index filename
publican.config.indexFilename = 'default.htm';

This changes slugs: content at blog/index.md now renders to blog/index/default.htm. You would need to rename the content file to blog/default.md to render it to blog/default.htm.

New post content properties #

The following post content properties are available:

Post data.menu property defaults #

The front matter menu value (and the data.menu content property) sets a page title used in menus that is typically shorter than the real title, e.g.

---
title: How to contact us
menu: Contact
---

Setting index: false allows you to omit a page from menus or breadcrumb trails by examining it’s value in tacs.nav global property.

From Publican v0.8.0, when menu is not set in front matter:

Post data.index property defaults #

The front matter index value (and the data.index content property) sets the search engine indexing frequency.

Setting index: false omits a page from the global tacs.dir property so it does not appear in directory indexes and sitemaps.

From Publican v0.8.0, rendered files that are not HTML or index pages are false by default unless explicitly overridden. It’s no longer be necessary to set index: false in the front matter for files such as XML, SVG, CSS, JavaScript, etc.

Other post property changes #

The following properties have changed:

Improved CSS file processing #

Publican can process CSS files like any other text content. It copies files as-is but you can insert jsTACS ${ expressions } if necessary.

This release fixes an issue which failed to process files containing CSS character entities in \XXXX format.

Improved JS file processing #

Publican can process client-side JavaScript files like any other text content. It copies files as-is but you can insert jsTACS ${ expressions } if necessary. Note:

  1. You cannot use backtick (`) characters inside expressions.
  2. Template literals intended for runtime processing must use !{ expressions }

For more information, refer to template literals in JavaScript.

New processRenderEnd event hook #

Publican calls a new function hook named processRenderEnd after all rendering and file writes are complete. It’s passed an array of changed file objects ({ slug, content }) and the global tacs object.

The function cannot change rendered files, but it can log changes or run other processes.

New basic theme #

A new basic Publican theme is available at:

The theme is fast, standards based, and uses best practise techniques. It features pages, blog posts, tag indexes, a light/dark switcher, RSS feed, sitemaps, security, and a 100% Lighthouse score.

Please download and adapt the theme for your own purposes.

New LiveLocalhost server #

The basic theme uses Publican alone for rendering – there are no other dependencies. In development mode, it provides a livelocalhost server to automatically reload HTML and CSS when files change.

Get started #

The Publican documentation provides a quick start guide, a detailed set-up guide, API references, and common recipes you can use and adapt for your own projects.