Walto is a modern and lightweight wmk theme for documentation sites. It is based upon the Alto Hugo theme by Liam Bigelow on behalf of CloudCannon. For an example of it in use, see the wmk documentation site. Main features:
- Pre-configured static site search with Pagefind.
- Light/dark modes and an easily adjustable color palette for both.
- Header and footer content configurable from
wmk_config.yaml. - Content-driven main navigation, optimized for a site with
nav: auto. - Optional announcement banner with a configurable expiration time.
- Creates a sitemap to facilitate search engine indexing (can be disabled).
-
The theme is designed for wmk v1.10 or newer. Older versions may not work.
-
For the Pagefind functionality to work, you must have
npminstalled and havenpxin yourPATH. -
For syntax highlighting in code blocks you need either Pygments or pandoc to be installed.
Most of the settings affecting Walto are in the site part of wmk_config. They fall into 6 kinds: (1) General information about the page or website; (2) links and images for the header and footer; (3) attributes to add javascript or css additions to the header or body without having to touch templates; (4) navigation and search settings; (5) banner; and (6) colors.
This is metadata that mainly affects the <head> part of the HTML for the page, although some of it has more visible effects.
-
site.project_nameis just the name of the website. It appears as the site name in the metadata, is appended to the page title and is used as the alt text for the site logo. -
site.base_urlandsite.leading_path: If your website is served from an independent domain or subdomain, then the latter of these should be the empty string (the default).site.base_urlshould be set to the absolute URL to the root page of the website (including the leading path, if any), but without the trailing/or/index.html. Examples:https://example.com,https://abc.def.io/docs. Thebase_urlmust be set for much of the metadata to be of any use when sharing your page on social media and for thesitemap.xmlfile to be produced but has little effect otherwise. -
site.default_og_image: This is used as a fallback image for social media (theog:imageproperty) if the page does not set apage.main_img. -
site.favicon: An object representing the different versions of the favicon for the site. It has the keysdefault.large,small,apple_touch,msapp_tile_colorandtheme_color. All are optional, but some defaults are set by Walto. -
site.localecan be overriden on a page-by-page basis withpage.locale. It should consist of a five character string of the formxx_YY, wherexxstands for the language code (lowercase) andYYfor the country or territory (preferably uppercase). Thelocalesetting affects theog:localeOpenGraph metadata attribute and may also affect thelangsetting for the document (see below). -
site.langcan be overridden on a page-by-page basis withpage.lang. It indicates thelangattribute of the HTML document, which affects Pagefind search. If neitherpage.langnorsite.langis specified but eitherpage.localeorsite.localeis, then thelangvalue is set to the first two letters of thelocalevalue, or falls back toenif neitherlocalenorlangis known. -
page.og_typecan be used to explicitly set theog:typeOpenGraph metadata attribute, which defaults toarticle(except on the front page where it is set towebsite). -
page.description, if present, should contain a short description of the content of the page. It is used as the value of theog:descriptionOpenGraph property. In the absence ofpage.description,page.summaryis used instead. Note thatpage.summarycan be autogenerated from the content of the page by settingpage.generate_summaryto True. -
page.titleappears in the<title>tag, as the value of theog:titleOpenGraph property, and is also used as the headline of the page. (If the page is produced by a standalone template rather than normal content, the inheritable attributetitleis used instead; similarly forlang,locale,description,og_type, andmain_img). -
site.disable_sitemap: If this is true, then thesitemap.xmlfile will not be produced, even ifsite.base_urlis set to an appropriate value.
-
site.logois an object describing the logo and/or title at the left of the header, with a link to the front page of the site. Its three keys areheading(the abbreviated project name),image(the optional logo image for the site), andimage_dark(an alternate version of the logo image to use in dark mode). Ifimagepoints to an SVG image withfillset tocurrentColor, thenimage_darkcan generally be omitted. Ifsite.logois not specified, thensite.project_nameis used as a fallback forsite.logo.heading. -
site.topnav_linksis an optional list of links to display in the right part of the header, immediately to the right of the mode switching icon and (in mobile) the main menu "hamburger" symbol. Each link is an object with the keysurl,labeland (optionally)iconandalt. The icon should be an SVG image whose height and width are equal; it will get a display size of 32x32 pixels. There is not much room here, so labels should be kept short and links few. -
site.header_css_classcan be used to affect how the header is displayed on narrow screens, i.e. mobile phones. The valuewrapcauses the right (the logo) and left (the links, mode toggle and menu) parts of the header to be broken into two lines on mobile. The valuehidden-linkscauses thetopnav_linksto be invisible in mobile. These may of course be combined if desired, i.e.wrap hidden-links. -
site.footeris an object with any of the keysdisable,css_class,htmlorlinks. The first of these, if set to True, obviously removes the footer entirely, while the second specifies its css class. The default value ofcss_classiscontain, meaning that the header is to be kept to the same width as the main body of the page. The value ofsite.footer.htmlis arbitrary HTML to insert at the start of the footer. As forsite.footer.links, that should be a list of items whose keys areurl,title(both required),imageandalt(both optional).
-
site.head_extracan be overridden bypage.head_extraand, if present, should contain HTML to insert at the end of the<head>section. Typically this is additional Javascript or CSS. -
site.end_of_body, if present, should contain HTML to insert just before the closing</body>tag. Typically this is a<script>tag.
-
site.pagefind: If this is True (the default), then Pagefind search is active on the page. If you disable this, you should also override the defaultcleanup_commandsso as to remove the indexing step. -
site.main_nav: Contains settings for the main navigation unit (in the hamburger menu on mobile and on the left in desktop and tablet). The keys aretitle(default: "Docs") andsections_collapsible(default: false). The title is the heading for the menu (only visible in desktop), whilesections_collapsibleindicates that the items under each section heading are initially hidden. In this case, the items belonging to a particular section only become visible when one of the pages under it is active or the section is toggled open by the user. This is especially useful for sites that have many pages and/or sections in the main navigation menu.
The site.banner setting defines an optional banner shown at the very top of the page with an announcement or welcome message. When dismissed, it will not reappear in that particular browser. The banner has the following keys:
enable: If this is set to false, the banner will never be shown. Default:true.html: The message itself.id: The HTMLidof the message. If you change this, the banner will reappear even if the user has dismissed it previously. Default:walto-banner.show_until: A datetime in ISO-8601 format indicating when the message expires. It will not be visible after that date.close_label: Text associated with the close button (for screen readers). Default: "Close".
The setting site.colors can be used to almost completely redefine the color scheme of the page. Here are the contents of the default data/wmk_config.d/site/colors.yaml file of the theme:
light:
typography:
text: '#000000'
flip-text: '#ffffff'
text-main: '#363636'
text-bright: '#000000'
text-muted: '#70777f'
links: '#0076d1'
highlight: '#de935f'
selection: '#9e9e9e'
form-placeholder: '#949494'
form-text: '#1d1d1d'
background_colors:
background-body: '#fff'
background-input: '#efefef'
background-alt: '#f7f7f7'
code_block_colors:
# measured-light
base00: "#fdf9f5"
base01: "#f9f5f1"
base02: "#ffeada"
base03: "#5a5a5a"
base04: "#404040"
base05: "#292929"
base06: "#181818"
base07: "#000000"
base08: "#ac1f35"
base09: "#ad5601"
base0a: "#645a00"
base0b: "#0c680c"
base0c: "#01716f"
base0d: "#0158ad"
base0e: "#6645c2"
base0f: "#a81a66"
button_colors:
button-base: '#d0cfcf'
button-hover: '#9b9b9b'
scrollbar_colors:
scrollbar-thumb: '#aaaaaa'
scrollbar-thumb-hover: '#9b9b9b'
border_colors:
border: '#dbdbdb'
focus_colors:
focus: '#0096bfab'
pagefind_colors:
pagefind-ui-primary: '#000000'
pagefind-ui-secondary: '#000000'
pagefind-ui-background: '#efefef'
pagefind-ui-border: '#dbdbdb'
pagefind-ui-tag: '#efefef'
dark:
typography:
text: '#e6edf3'
flip-text: '#e6edf3'
text-main: '#e6edf3'
text-bright: '#ffffff'
text-muted: '#c8c8c8'
links: '#58a4e0'
highlight: '#de935f'
selection: '#616161'
form-placeholder: '#e0e0e0'
form-text: '#f0f0f0'
background_colors:
background-body: '#121516'
background-input: '#1d1f21'
background-alt: '#080808'
code_block_colors:
# railscasts
base00: "#2b2b2b"
base01: "#272935"
base02: "#3a4055"
base03: "#5a647e"
base04: "#d4cfc9"
base05: "#e6e1dc"
base06: "#f4f1ed"
base07: "#f9f7f3"
base08: "#da4939"
base09: "#cc7833"
base0a: "#ffc66d"
base0b: "#a5c261"
base0c: "#519f50"
base0d: "#6d9cbe"
base0e: "#b6b3eb"
base0f: "#bc9458"
button_colors:
button-base: '#2b2b2b'
button-hover: '#606060'
scrollbar_colors:
scrollbar-thumb: '#555555'
border_colors:
border: '#dbdbdb'
focus_colors:
focus: '#0096bfab'
pagefind_colors:
pagefind-ui-primary: '#D8D8D8'
pagefind-ui-secondary: '#D8D8D8'
pagefind-ui-background: '#1d1f21'
pagefind-ui-border: '#2b2b2b'
pagefind-ui-tag: '#1d1f21'As can be seen from the above, there are separate settings for light and dark mode, each of which is divided into logical sections. Most of them are self-explanatory. You only need to set the values for the colors that you actually modify (except for the pagefind-ui colors, since they apply to a separate stylesheet).
The code highlighting palette follows the base16 convention. A gallery with many such color palettes is available here.
The following defaults set by Walto apply at the top level of the configuration file and are not part of the site section.
-
pandocis not set by Waldo but is supported by the theme. Ifpandocis set to true, Pandoc will be used to convert your markup to HTML. This is needed if you have non-markdown content or want to use some of Pandoc's special features. You may also prefer Pandoc's code highlighting output to that of Pygments – or possibly may want to avoid installing the latter. -
toc: This is is set to true by Walto, so as to ensure that subheadings get anidattribute in the HTML. This, in turn, activates the anchor link feature (the muted hashtag to the left of headings). Otherwise it does not affect rendering in this theme. If you have activated Pandoc, thetocsetting is not needed for the anchor feature to work, and may be turned off for slightly improved performance. -
markdown_extensionsis set to['extra', 'sane_lists', 'toc', 'pymdownx.superfences', 'pymdownx.highlight']by Waldo, and in the settings forpymdownx.highlightPygments is turned on. -
cleanup_commandsis set to['npx -y pagefind --site htdocs'], which builds the Pagefind index. If you have setsite.pagefindto False you should turn this off as well (or replace it with your own commands).
The only major consideration when authoring content for use by Waldo is to make sure that the main navigation menu is populated properly. Walto sets nav to auto by default, so the easiest and most natural way to do this is to add nav_section and nav_order (or weight) to the front matter in your content files. For details, see the wmk documentation.
The navigation menu can of course also be defined manually. In this case, be aware that Walto does not support multiple levels of nesting out of the box. It is designed for a simple list of links or sections, with each section only containing links and no subsections of their own.