Module:PersonPage: Difference between revisions
From The Seven Sages of Rome
Created page with "local p = {} function p.redirect(frame) local target = frame.args[1] or frame:getParent().args[1] -- Basic validation if not target or target == '' then return 'No target page specified.' end -- Return the redirect with no extra whitespace return '#REDIRECT ' .. target .. '' end return p" |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
function p. | function p.render(frame) | ||
local | local args = frame:getParent().args | ||
local canonicalName = args['Has Canonical Name'] | |||
if | if canonicalName and canonicalName ~= '' then | ||
return ' | -- This outputs ONLY the redirect if Has Canonical Name is set | ||
return '#REDIRECT [[' .. canonicalName .. ']]' | |||
end | end | ||
-- | -- Otherwise return nothing and allow page content to be displayed | ||
return ' | return '' | ||
end | end | ||
return p | return p | ||
Revision as of 17:24, 14 March 2025
Documentation for this module may be created at Module:PersonPage/doc
local p = {}
function p.render(frame)
local args = frame:getParent().args
local canonicalName = args['Has Canonical Name']
if canonicalName and canonicalName ~= '' then
-- This outputs ONLY the redirect if Has Canonical Name is set
return '#REDIRECT [[' .. canonicalName .. ']]'
end
-- Otherwise return nothing and allow page content to be displayed
return ''
end
return p