i18n and search functions

Table of Contents

#i18n

Translation in Marisa is done differently from Zola’s built-in way.

We use an object marisa_i18n in [extra] section of thene.toml to define i18n data.

This allows for quick site-specific translation without using any third-party tools, as well as to provide some nicety like matching emoji to text, or using quoted text with string replacement.

marisa_i18n = [
    { name = "default_icon", icon="🔸", zh = "", en = "" },
    { name = "date", icon="📅", en = "Date", zh = "日期" },
    { name = "continue_reading,_$1_mins", icon="", en = "Continue reading, est. $1 mins", zh = "继续阅读,大约 $1 分钟" },

The text is then loaded through macros/page-i18n.html, which handles the i18n automatically, as defined by default_language.

Marisa currently only support Fuse/Tinysearch based search indexes, this is chosen based on the actual usage: users likely want a fuzzy search instead of some advanced boolean ops.

See more at Zola and Fuse’s documentation.

🔍 Search results