Saintapedia:Template documentation: Difference between revisions

no edit summary
(Created page with "= Saintapedia:Template Documentation for Portal:Homepage = This page provides documentation for templates used on the Portal:Homepage of Saintapedia. Templates are reusable components that help structure and standardize content across the wiki, particularly for organizing information about saints, parishes, dioceses, and Catholic demographics. This guide explains how to use these templates, including the `{{Documentation subpage}}` mechanism, and provides instructio...")
 
No edit summary
Line 1: Line 1:
= Saintapedia:Template Documentation for Portal:Homepage =
= Saintapedia:Template Documentation =


This page provides documentation for templates used on the [[Portal:Homepage]] of Saintapedia. Templates are reusable components that help structure and standardize content across the wiki, particularly for organizing information about saints, parishes, dioceses, and Catholic demographics. This guide explains how to use these templates, including the `{{Documentation subpage}}` mechanism, and provides instructions for editors.
This page provides guidance for creating and maintaining documentation for all templates on Saintapedia. Templates are reusable components that standardize content presentation, simplify editing, and support dynamic data display (e.g., via Cargo tables) for topics like saints, parishes, dioceses, and Catholic demographics. Proper documentation ensures templates are easy to use and maintain. This guide explains the `{{Documentation subpage}}` template and best practices for documenting any template on the wiki.


== Purpose of Templates on Portal:Homepage ==
== Purpose of Template Documentation ==
The [[Portal:Homepage]] serves as the main entry point for Saintapedia, offering an overview of the wiki’s content, including 478 saints, 295 parishes, 212 countries, and various dioceses. Templates on this page, such as `{{Portal/core}}`, ensure consistent formatting, easy navigation, and dynamic data display using features like Cargo tables for structured data querying.[](https://saintapedia.org/wiki/Portal:Homepage)
Template documentation explains how a template works, its parameters, and how to use it correctly. It is typically hosted on a subpage (e.g., `Template:<TemplateName>/doc`) and linked from the template page. Documentation is essential for:
* Clarity: Helping editors understand the template’s purpose and usage.
* Consistency: Ensuring templates are used uniformly across Saintapedia.
* Collaboration: Encouraging editors to improve templates via talk pages or sandboxes.
* Maintenance: Simplifying updates, especially for templates using Cargo or other extensions.


Templates are critical for:
== Using {{Documentation subpage}} ==
* Consistency: Uniform presentation of information across the portal.
The `{{Documentation subpage}}` template marks a page as the documentation for a specific template. It is placed at the top of a subpage (e.g., `Template:Example/doc`) to indicate its purpose and provide navigation links.
* Ease of Maintenance: Centralized updates to design or functionality.
* Data Integration: Leveraging Cargo tables for searchable and sortable content, such as saint biographies or parish details by region.[](https://saintapedia.org/wiki/Portal:Homepage)


== Key Templates Used ==
* '''Usage''':
The following templates are integral to the [[Portal:Homepage]]:
<pre>{{Documentation subpage}}</pre>
Place this at the start of the documentation subpage. It displays a notice stating that the page documents a template, with links to the template, its talk page, and (if available) sandbox or testcases.
* '''Purpose''':
* Clarifies that the page is documentation, not a standalone article.
* Encourages editors to discuss improvements on the template’s talk page.
* Supports testing in a sandbox to avoid breaking live templates.
* '''Example''': For a template named `{{Infobox saint}}`, the documentation page at `Template:Infobox saint/doc` would start with:
<pre>{{Documentation subpage}}</pre>
Followed by sections explaining the template’s purpose, parameters, and usage.
 
== Creating Template Documentation ==
To create documentation for any template on Saintapedia:


=== {{Portal/core}} ===
1. Create the Documentation Subpage:
* '''Purpose''': Provides the core structure for the portal, including a header with a puzzle icon and a link to the portal page.[](https://saintapedia.org/wiki/Template:Portal/core)
* Navigate to `Template:<TemplateName>/doc` (e.g., `Template:Infobox saint/doc`).
* '''Usage''':
* If it doesn’t exist, create the page by editing it.
  <pre>{{Portal/core|Homepage}}</pre>
* Add `{{Documentation subpage}}` at the top.
  This renders a centered header with the text "Homepage portal" and an associated image (e.g., Portal-puzzle.png). Note: If the image file is broken, editors should check the file library or upload a new version.[](https://saintapedia.org/wiki/Template:Portal/core)
2. Structure the Documentation:
* '''Parameters''':
Use the following standard format:
  * `|1=` – The name of the portal (e.g., "Homepage").
* Purpose: Describe what the template does (e.g., “Displays a standardized infobox for saint biographies”).
* '''Example Output''':
* Usage: Provide the basic syntax (e.g., `{{TemplateName|parameter1|parameter2}}`).
  <div style="text-align: center; padding: 0 0.2em; vertical-align: middle; font-style: italic; font-weight: bold">[[Portal:Homepage|Homepage portal]]</div>
* Parameters: List all parameters, their purpose, and whether they are optional or required. Use a table or bullet points for clarity.
* Examples: Show how the template renders with sample inputs.
* Notes: Highlight dependencies (e.g., Cargo tables, specific extensions), common issues, or styling tips.
Example structure for `Template:Infobox saint/doc`:
<pre>
{{Documentation subpage}}
== Purpose ==
The {{Infobox saint}} template creates a standardized infobox for saint biographies, displaying key details like feast day, patronage, and birth/death dates.


=== Other Potential Templates ===
== Usage ==
While `{{Portal/core}}` is explicitly used, other templates may be transcluded on the [[Portal:Homepage]] for displaying Cargo table data or navigation elements. Examples include:
<pre>{{Infobox saint
* Infobox templates (e.g., `{{Infobox saint}}`): For structured saint biographies.
| name =
* Navbox templates: For navigation links at the bottom of the page, grouping related content like saints by country or feast day.[](https://saintapedia.org/wiki/Help:Navigation)
| feast_day =
* Cargo query templates: For dynamic lists, such as saints by region or parishes by diocese, using the Cargo MediaWiki extension.[](https://saintapedia.org/wiki/Portal:Homepage)
| patronage =
}}</pre>


== Understanding {{Documentation subpage}} ==
== Parameters ==
The `{{Documentation subpage}}` template is a standard MediaWiki tool used to indicate that a page (e.g., `/doc`) is the documentation for a specific template. On Saintapedia, it helps editors understand how to use templates like `{{Portal/core}}` without cluttering the template code itself.
* name – The saint’s name (required).
* feast_day – The saint’s feast day (optional).
* patronage – Areas or groups the saint is patron of (optional).


* '''Purpose''': Marks a page as a documentation subpage, typically located at `Template:<TemplateName>/doc` (e.g., `Template:Portal/core/doc`).
== Example ==
* '''Usage''':
{{Infobox saint
  <pre>{{Documentation subpage}}</pre>
| name = Saint Francis of Assisi
  Place this at the top of the documentation page. It displays a notice explaining that the page documents a template and provides links to the template, its talk page, and sandbox/testcases (if available).
| feast_day = October 4
* '''Why Use It?''':
| patronage = Animals, Italy
  * Clarifies that the page is for documentation, not a standalone article.
}}
  * Encourages editors to contribute to the template’s improvement via the talk page.
Produces: [Infobox rendering]
  * Supports testing in a sandbox to avoid breaking live templates.
* '''Example''': For `{{Portal/core}}`, the documentation page at `Template:Portal/core/doc` would start with:
  <pre>{{Documentation subpage}}</pre>
  Followed by a description of the template’s purpose, parameters, and usage examples.


== Creating and Editing Template Documentation ==
== Notes ==
To create or edit documentation for a template used on [[Portal:Homepage]]:
* Ensure dates follow Saintapedia’s style guide (e.g., “October 4” not “4 October”).
* Use Cargo queries for dynamic fields like parish lists, if applicable.


1. Locate or Create the Documentation Subpage:
[[Category:Template documentation]]
  * Navigate to `Template:<TemplateName>/doc` (e.g., `Template:Portal/core/doc`).
</pre>
  * If it doesn’t exist, create it by editing the page and adding `{{Documentation subpage}}` at the top.
3. Link to Documentation:
2. Structure the Documentation:
* Add `{{Documentation}}` to the bottom of the template page (e.g., `Template:Infobox saint`) to display the documentation subpage content.
  * Purpose: Explain what the template does.
* Use `<noinclude>{{Documentation}}</noinclude>` to ensure it only appears on the template page, not where the template is transcluded.
  * Usage: Provide the syntax (e.g., `{{TemplateName|parameter1|parameter2}}`).
4. Use VisualEditor or Wikitext:
  * Parameters: List all parameters, their purpose, and whether they are optional or required.
* Saintapedia supports VisualEditor for ease of use, but wikitext is recommended for precise control in template documentation.
  * Examples: Show how the template renders with sample inputs.
* Use “Show preview” to check formatting before saving.
  * Notes: Mention any dependencies (e.g., Cargo tables, specific extensions) or common issues (e.g., broken file links).[](https://saintapedia.org/wiki/Template:Portal/core)
3. Use VisualEditor or Wikitext:
  * Saintapedia supports VisualEditor for easier editing, but wikitext is preferred for precision in template documentation.[](https://saintapedia.org/wiki/Tutorial_%28Saintapedia%29)
  * Use the “Show preview” button to check your changes before saving.[](https://saintapedia.org/wiki/Tutorial_%28Saintapedia%29)
4. Link to Documentation:
  * Ensure the template page (e.g., `Template:Portal/core`) includes a link to its documentation using:
    <pre>{{Documentation}}</pre>
    This automatically displays the `/doc` subpage content below the template code.
5. Test Changes:
5. Test Changes:
  * Use a sandbox (e.g., `Template:Portal/core/sandbox`) to test modifications before applying them to the live template.
* Create a sandbox (e.g., `Template:<TemplateName>/sandbox`) to test template modifications.
  * Check for broken links or missing files, such as `Portal-puzzle.png`.[](https://saintapedia.org/wiki/Template:Portal/core)
* Use testcases (e.g., `Template:<TemplateName>/testcases`) to compare outputs.
* Verify functionality on a test page before applying changes to live templates.


== Best Practices ==
== Best Practices ==
* Be Clear and Concise: Write documentation that is easy for new editors to understand.
* Be Clear and Concise: Write documentation that is accessible to new editors while including technical details for advanced users.
* Use Cargo for Dynamic Content: If the template pulls data from Cargo tables (e.g., for saints or parishes), explain how to query or update the data.[](https://saintapedia.org/wiki/Portal:Homepage)
* Standardize Formatting: Follow a consistent structure (Purpose, Usage, Parameters, Examples, Notes) for all template documentation.
* Maintain Consistency: Follow Saintapedia’s style guide for templates to ensure uniformity.
* Leverage Cargo: For templates using Cargo tables (e.g., for saint or parish data), explain how to query or update data. Reference [[Help:Cargo]] for details.
* Check for Broken Links: Regularly verify that images or linked pages (e.g., `Portal-puzzle.png`) are functional.[](https://saintapedia.org/wiki/Template:Portal/core)
* Check Dependencies: Ensure linked files (e.g., images) or extensions (e.g., Cargo) are functional. Report broken links to administrators.
* Encourage Collaboration: Invite editors to discuss improvements on the template’s talk page.
* Encourage Collaboration: Invite editors to discuss improvements on the template’s talk page or join [[Saintapedia:WikiProject]].
* Categorize Documentation: Add `[[Category:Template documentation]]` to all documentation subpages for easy navigation.


== Troubleshooting ==
== Troubleshooting ==
* Broken File Links: If a template like `{{Portal/core}}` references a missing file (e.g., `Portal-puzzle.png`), check the file library or upload a replacement.[](https://saintapedia.org/wiki/Template:Portal/core)
* Template Not Rendering: Check for syntax errors, missing parameters, or changes in transcluded templates.
* Cargo Query Issues: Ensure Cargo tables are properly defined and populated. Use the Cargo drilldown feature to test queries.[](https://saintapedia.org/wiki/Portal:Homepage)
* Broken File Links: Verify that images (e.g., icons used in templates) exist in the file library. Upload replacements if needed.
* Template Not Rendering: Verify that parameters are correctly formatted and that transcluded templates haven’t changed.[](https://saintapedia.org/wiki/Help:Permanent_link)
* Cargo Query Issues: Ensure Cargo tables are defined and populated correctly. Use Cargo drilldown to test queries.
* VisualEditor vs. Wikitext: If VisualEditor introduces errors, switch to wikitext for precise control.[](https://saintapedia.org/wiki/Tutorial_%28Saintapedia%29)
* VisualEditor Errors: Switch to wikitext mode if VisualEditor introduces formatting issues.
* Documentation Not Displaying: Confirm that `{{Documentation}}` is included in the template page and that the `/doc` subpage exists.
 
== Examples of Common Templates ==
Below are examples of templates you might document on Saintapedia:
* Infobox Templates: `{{Infobox saint}}`, `{{Infobox parish}}` – For structured data display.
* Navbox Templates: `{{Saints by country}}` – For navigation links grouping related content.
* Cargo Query Templates: `{{Saints by region}}` – For dynamic lists using Cargo tables.
* Utility Templates: `{{Cite web}}` – For consistent citation formatting.
 
For each, create a `/doc` subpage with `{{Documentation subpage}}` and follow the structure outlined above.


== See Also ==
== See Also ==
* [[Help:Navigation]] – Guidance on navigating Saintapedia, including portal features.[](https://saintapedia.org/wiki/Help:Navigation)
* [[Help:Templates]] – General guide to creating and using templates.
* [[Help:Editing Saintapedia]] – Instructions for editing, including VisualEditor and wikitext.[](https://saintapedia.org/wiki/Tutorial_%28Saintapedia%29)
* [[Help:Cargo]] – Documentation for Cargo queries used in dynamic templates.
* [[Help:Permanent link]] – How to link to specific versions of template pages.[](https://saintapedia.org/wiki/Help:Permanent_link)
* [[Help:Editing Saintapedia]] – Instructions for editing with VisualEditor or wikitext.
* [[Saintapedia:WikiProject]] – Collaborate on improving Saintapedia’s templates and content.[](https://saintapedia.org/wiki/Portal:Homepage)
* [[Saintapedia:WikiProject]] – Collaborate on improving Saintapedia’s templates and content.


[[Category:Saintapedia documentation]]
[[Category:Saintapedia documentation]]
[[Category:Template documentation]]
[[Category:Template documentation]]