Jump to content

Module:Featured/doc

From HopperWiki

This is the documentation page for Module:Featured

Module:Featured

This module is used to dynamically render and archive "featured" content on HopperWiki. Common themes include featured people, resources, and species. It provides a clean and maintainable way to manage, display, and update featured content using the Template:Featured register template and Cargo for automatic registration and querying.

Features

  • Dynamically displays the most recent featured item on the front page
  • Supports archive rendering for all previous featured items
  • Uses Template:Featured register on each subpage for automatic Cargo registration — no separate index page required
  • Driven by simple metadata (date_featured) stored directly in Cargo

Usage

Use this to show the latest featured item of a specific type (e.g., on the front page):

{{#invoke:Featured|render|person}}
{{#invoke:Featured|render|resource}}
{{#invoke:Featured|render|species}}

Use this to show all featured entries of a given type, in reverse chronological order:

{{#invoke:Featured|render_archive|person}}
{{#invoke:Featured|render_archive|resource}}
{{#invoke:Featured|render_archive|species}}

This will transclude each featured item subpage and display them all together.

Creating a new featured item requires only one step: create a subpage under the appropriate template and call {{Featured register}} at the top (no wrapping tags needed on the subpage itself).

For example, to add a new featured person, create Template:Featured person/Hector Medina with:

{{Featured register|type=person|date_featured=YYYY-MM-DD}}
Content of the featured card goes here...

Substitute person with resource or species as appropriate. The Cargo table updates automatically on save — no index page edit required.

Setting date_featured to a future date will suppress the item until that date arrives, since the module only selects entries on or before today.

Template:Featured register

This template handles Cargo registration for all featured subpages. It declares and stores to the Featured_content Cargo table with the following fields:

  • type — content type (person, resource, or species)
  • featured_page — full page name, auto-populated via {{FULLPAGENAME}}
  • date_featured — ISO date string (YYYY-MM-DD) controlling display order

Configuration

This module supports multiple content types via internal configuration. Each type defines:

  • template_prefix — base template namespace (e.g., Template:Featured person/)

To add a new type, add an entry to the featured_types table in the module — no changes to {{Featured register}} or the Cargo table are needed.

See also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.