Template:Service link

From Against the Storm Official Wiki
Revision as of 02:13, 13 December 2023 by Aeredor (talk | contribs) (Created to make linking to pages on services easier)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Service link is a template that creates links to services on the wiki and includes an icon for improved recognition. Reuses standardizes icon size templates for consistency.

Overview

This template should be used liberally across the wiki, wherever the names of services are mentioned in paragraphs or in tables. The accompanying icons will help skimming for expert players and orientation for new players.

For in-paragraph display, which is presumed to be the most common utilization, the default icon size is small, or x16px from Template:ImgS. For use in tables where more spacing between lines doesn't hurt readability or aesthetics, it is recommended to use med, which will increase the size of the icons to x30px (from Template:ImgM).

Use your judgment when writing content. The first mention of a service in a paragraph should probably be done with this template. But you may find that paragraphs densely mentioning services become harder not easier to read. You may decide that after the first mention of the service , it's better for subsequent references to be in plain text or with this template but without an icon.

Usage

{{Service link|service|iconsize}}

Parameters

Only the first parameter, service is required, and it must be spelled correctly to match the in-game name of the service. The other parameter is optional but improve this template's applicability to more instances of its use. You may include or omit any parameters' names.

Parameter Type Description
service string Required. The in-game name of the service whose page you want to link to and whose icon you might want to display.
iconsize string One of the following values to indicate the desired size of the icon:
  • none
  • small
  • med
  • large
  • huge

which will prevent an icon from displaying
which sizes the icon to x16px from Template:ImgS, default
which sizes the icon to x30px from Template:ImgM
which sizes the icon to x60px from Template:ImgL
which sizes the icon to x84px from Template:ImgH

Errors

When the template is called without a service name, the template reminds you that it is required.

Example:

{{Service link}}

Yields:

Script error: The function "serviceLink" does not exist.

When providing the name of a service, it is important that it is spelled correctly, including any punctuation or spaces. Otherwise, you will see an error message:

Example:

Broken: {{Service link|Educatoin}}

Script error: The function "serviceLink" does not exist.

Fixed: {{Service link|Education}}

Script error: The function "serviceLink" does not exist.

Additional Examples and Errors

Here are ways to call the template and the expected result:

Parameters Examples Expected outcome
None {{Service link}} An error.
service only {{Service link|Luxury}} A small, text-sized icon and link, best for within paragraphs.
service and iconsize {{Service link|Leisure|small}}
{{Service link|Treatment|med}} A moderately-sized icon and a link, best in dense tables.
{{Service link|Brawling|large}} A large icon and a link, best as featured items within tables.
{{Service link|Religion|huge}} A very large icon and a link, in case you every need one this big.

The following are generated by calling the template.

1 {{Service link|Education|none}} yields:

Script error: The function "serviceLink" does not exist.

2. {{Service link|Education|small}} yields:

Script error: The function "serviceLink" does not exist.

3. {{Service link|Education|med}} yields:

Script error: The function "serviceLink" does not exist.

4. {{Service link|Education|large}} yields:

Script error: The function "serviceLink" does not exist.

5. {{Service link|Education|huge}} yields:

Script error: The function "serviceLink" does not exist.

The following are additional incorrect usages of the template:

6. With no service but an icon size, {{Service link||large}} yields:

Script error: The function "serviceLink" does not exist.

Finally, providing an icon size that is not recognized does not break the template. There is a default icon size instead of returning an error.

9. With a valid service but invalid icon size, {{Service link|Education|gigantic}} yields:

Script error: The function "serviceLink" does not exist.