Showcase: Functions

Published 26.11.2025 04:55 Edited 02.12.2025 08:56 By Stefan

Gravitron includes a series of handy functions like tags, categories, a page media gallery… And more is still to come. A demo for the sitemap-style listing of all existing pages is available here.

Per-page custom CSS

If enabled by setting css: in the page head and the specified CSS file exists in the folder of the page, the file is loaded automatically last in order: This way CSS overrides or extensions are possible per page, see the nicotine background gradient to the right bottom of this page:

css: "showcase-functions-custom.css"

Page aliases

Pages can have one or more alias URLs. The YAML page header of /showcase/theme has defined 3 alias URLs as list:

aliases:
    - "/demopage"
    - "/showcase/css"
    - "/css"

A single alias may also be specified as string, not as an array/list:

aliases: "/otherpage"

The page Showcase: Theme is thus reachable via /demopage, /showcase/css and /css. The canonical page meta tag is however SEO friendly set to the real URL:

<link rel="canonical" href="https://gravitron.dev/showcase/theme">

Be sure not to define identical alias URLs for more than one page or an alias with a primary URL of a page! While primary page URLs are processed first, multiple identical aliases may lead to unpredictable results. (The first match in pages order wins, but I won't tell you…)

Files

If enabled globally via ENABLE_PAGE_FILES, files in a page folder are propagated to the Twig array page_files for file extensions listed in ALLOWED_PAGE_FILETYPES. Any custom page CSS file is ignored, see section "Per-page custom CSS" above:

Media files

If enabled globally via ENABLE_PAGE_FILES, image and video files defined in ALLOWED_MEDIA_FILETYPES, are available in page_mediafiles and can automatically be shown in an in-page gallery. — see below. Andre Rinas SimpleLightbox is used for image links with rel="lightbox". Any custom page CSS file is ignored, see section Per-page custom CSS above:

Gallery

Theme information

This theme has a user/config/theme.yaml file. If present and valid, its content together with configuration data is propagated to the Twig array theme: