Module:SiteListModule
Jump to navigation
Jump to search
Documentation for this module may be created at Module:SiteListModule/doc
local p = {} local websites = { website1 = { url = "https://website1.com", modelPath = "/models/", updatePath = "/updates/", defaultPath = "", category = "[[:Category:Network1|Network1]]" }, website2 = { url = "https://website2.com", modelPath = "/people/", updatePath = "/scene/", defaultPath = "", category = "[[:Category:Network2|Network2]]" }, website3 = { url = "https://website3.com", modelPath = "/performers/", updatePath = "/videos/", defaultPath = "", category = "[[:Category:Network3|Network3]]" } } function p.site(frame) local siteKey = frame.args.site local id = frame.args.id or "" local sceneid = frame.args.sceneid or "" local alias = frame.args.alias or "" local notes = frame.args.notes or "N/A" if websites[siteKey] then local site = websites[siteKey] local siteURL = "" if id and sceneid then siteURL = site.url .. site.updatePath .. sceneid .. ".html" elseif id then siteURL = site.url .. site.modelPath .. id .. ".html" else siteURL = site.url end return string.format('[%s %s] <small>(%s)</small>', siteURL, siteKey, site.category) else return "None" end end function p.addCategory(frame) local namespace = mw.title.getCurrentTitle().namespace local category = "" if namespace == 0 then -- mainspace category = "[[Category:Articles in the mainspace using Template:SiteList]]" elseif namespace == 2 then -- userspace category = "[[Category:Articles in the userspace using Template:SiteList]]" elseif namespace == 118 then -- draft category = "[[Category:Drafts using Template:SiteList]]" end return category end return p