Difference between revisions of "Template:GetMetaData"

From Pathfinder Wiki
(Created page with "<includeonly>{{#vardefine:page|{{{page|{{#if:{{{honor|}}}|AY Honors/{{{honor}}}|{{#titleparts:{{PAGENAME}}|2}}}}}}}}}{{#vardefine:srcpage|{{#if:{{#explode:{{#var:page}}|(|1}}}...")
 
Line 4: Line 4:
 
</includeonly>
 
</includeonly>
 
<noinclude>
 
<noinclude>
This template returns the page title of an honor's main landing page.  It accepts a page argument which can be any subpage of an honor, and it can also be any variant of an honor.  If no page argument is given, it can accept an honor insteadIf neither a page nor an honor argument is supplied, the template will assume it is being invoked from an honor page or subpage.
+
This template returns the value of a parameter as defined in a template on a given honor landing page.  It takes three arguments:
 
+
;page|honor: You can specify either the page or the honor.  If you specify both it will use page.  The page argument is the page title of an honor or one of its subpagesIt accepts translated pages, but ignores that since the metadata is in the honor's "source" page which is in English.  This could give problems when trying to fetch an honorname.  If you need the translated version of any other parameter, you should be able to use [[:Template:Localize]] to convert it.
The page the template returns is the master source of metadata for the honor.
+
;template: If omitted, this will specify which template holds the parameter you want.  It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
 +
;parameter: This specifies which parameter of template you want the template to return.  It will always return the English value of the parameter.  Again... [[:Template:Localize]] is your friend, but note that Localize only works on a translate page (or we'd demonstrate it here).
  
 +
==Examples==
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}}
 
*<nowiki>{{</nowiki>GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} &rarr; {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}}

Revision as of 04:45, 22 March 2021


This template returns the value of a parameter as defined in a template on a given honor landing page. It takes three arguments:

page|honor
You can specify either the page or the honor. If you specify both it will use page. The page argument is the page title of an honor or one of its subpages. It accepts translated pages, but ignores that since the metadata is in the honor's "source" page which is in English. This could give problems when trying to fetch an honorname. If you need the translated version of any other parameter, you should be able to use Template:Localize to convert it.
template
If omitted, this will specify which template holds the parameter you want. It defaults to HonorLanding, but if you are experimenting and have some other template in place, you can specify it.
parameter
This specifies which parameter of template you want the template to return. It will always return the English value of the parameter. Again... Template:Localize is your friend, but note that Localize only works on a translate page (or we'd demonstrate it here).

Examples

  • {{GetMetaData|page=AY Honors/Cycling/Requirements|parameter=category}} → Recreation
  • AY Honors/Cycling/Requirements
  • AY Honors/Cycling


  • {{GetMetaData|page=AY Honors/Cycling/Requirements/es|parameter=skill}} → 1
  • AY Honors/Cycling/Requirements/es
  • AY Honors/Cycling


  • {{GetMetaData|honor=Camping Skills III|parameter=authority}} → General Conference
  • AY Honors/Camping Skills III
  • AY Honors/Camping Skills III


  • {{GetMetaData|honor=Animal Tracking (General Conference)|parameter=year}} → 1976
  • AY Honors/Animal Tracking
  • AY Honors/Animal Tracking