Module:ElementHubNavigation: Difference between revisions
// via Wikitext Extension for VSCode |
// via Wikitext Extension for VSCode |
||
| Line 9: | Line 9: | ||
local p = {} | local p = {} | ||
-- Hub configuration with icon | -- Hub configuration with icon file mappings | ||
local hubs = { | local hubs = { | ||
{ label = 'Nations', url = 'Hub:Nations', | { label = 'Nations', url = 'Hub:Nations', icon = 'Icon-Globe.svg' }, | ||
{ label = 'People', url = 'Hub:People', | { label = 'People', url = 'Hub:People', icon = 'Icon-User.svg' }, | ||
{ label = 'Organizations', url = 'Hub:Organizations', | { label = 'Organizations', url = 'Hub:Organizations', icon = 'Icon-Building.svg' }, | ||
{ label = 'Events', url = 'Hub:Events', | { label = 'Events', url = 'Hub:Events', icon = 'Icon-Calendar.svg' }, | ||
{ label = 'Topics', url = 'Hub:Topics', | { label = 'Topics', url = 'Hub:Topics', icon = 'Icon-Layers.svg' } | ||
} | } | ||
-- Generate a single hub link item using MediaWiki File reference | |||
-- Generate a single hub link item | |||
local function generateHubLink(hub) | local function generateHubLink(hub) | ||
local iconHtml = | local iconHtml = string.format('[[File:%s|24px|link=|class=hub-icon]]', hub.icon) | ||
return string.format( | return string.format( | ||
'<li class="cdx-hub__item"><span class=" | '<li class="cdx-hub__item"><span class="cdx-hub__link">%s[[%s|%s]]</span></li>', | ||
iconHtml, | iconHtml, | ||
hub.url, | hub.url, | ||