welpo a7833299ff
💥 feat!: add tag filtering for projects (#431)
- Card (project) images no longer require manual top/bottom margin
adjustments for proper spacing. Action needed: Review existing card
images as previous manual margin adjustments may now be
unnecessary/excessive.
- Sites using `cards.html` with tags will now load JavaScript by
default when tags are present. To maintain no-JS behaviour, explicitly
set `enable_cards_tag_filtering = false` in either `config.toml` or the
`_index.md` file where `cards.html` is used.
2024-11-17 00:38:32 +01:00

3.0 KiB

+++ title = "No mandatory JavaScript" date = 2023-01-06 updated = 2024-11-16 description = "JavaScript is only used when HTML and CSS aren't enough."

[taxonomies] tags = ["showcase", "tutorial"]

[extra] social_media_card = "social_cards/blog_javascript.jpg" +++

This theme has no mandatory JavaScript. Optionally, it can load a minimal amount to add some features that are impossible to achieve with HTML and CSS.

Globally enabled settings

  • Search. Enabled by setting a default language and build_search_index = true on the main section of config.toml. (~23KB of JavaScript)

  • The light/dark mode switch can be enabled by setting theme_switcher = true in the [extra] section of your config.toml (~1KB of JavaScript).

  • E-mail decoding (~400 bytes). To protect against spambots scraping your e-mail from your website, you can set encode_plaintext_email = true. If your site is on a public repository, for extra protection, consider setting your email as a base64-encoded string1 directly.

Settings with hierarchical override capability

The following settings can be specified for posts, sections and globally, following the hierarchy of page > section > config.toml:

To specify these settings:

  • Globally: Add them under the [extra] section in your config.toml file.
  • For a section: Add them under the [extra] section in the front matter of the section's _index.md.
  • For an individual post: Set the corresponding variables in the [extra] section of the post's front matter.

Settings that can be enabled globally or for individual posts

  • Comments. giscus (2 KB), utterances (1 KB), Hyvor Talk (~800 bytes) or Isso (1KB) can be globally enabled by setting enabled_for_all_posts = true in the right section of your config.toml (i.e. [extra.giscus], [extra.utterances], [extra.hyvortalk] or [extra.isso]). To enable comments on individual posts, set the name of the system = true (e.g. hyvortalk = true) in the post's front matter.

Other than that, it's a fast theme with HTML and CSS which works with JavaScript disabled. Just the way (most of) the web should be :-)


  1. To encode your email in base64 you can use online tools or, on your terminal, run: printf 'mail@example.com' | base64. ↩︎