Template:Github link/doc

From MozillaWiki
Jump to: navigation, search
Edit-copy green.svg
This is a documentation subpage for Template:Github link.
It contains usage information, categories and other content that is not part of the original template page.


{{gitlink}} creates a link to a project or repository on Github.


There are 4 parameters, 2 unnamed ad 2 named, none of which is strictly required.


The template's syntax is

  • {{gitlink|project/repository |custom link text |icon=yes |size=banner size}}
Case Template code
Simplest use {{gitlink}}
Basic use project/repository|custom link text }}
Full: link project/repository|custom link text|icon=yes}}
Full: banner icon=yes|size=}}

Optional parameters


Path to project or repository

Enter the path to the project or the repository to which you want to link (the path is the part of the URL that follows after the top-level domain, e.g. .com/). As an example, the path in red: https://github.com/project/repository/repo-dir.

  • If no custom link text is provided (parameter |2), the template will use the entered path as link text.
  • By default, the template links to Mozilla's project page.
  • {{gitlink|1}}


Custom link text

You can specify a custom link text if you like.

  • This parameter is dependant on parameter |1. If that isn't specified, the template will fall back to display a link to Mozilla's project page.
  • {{gitlink|1|2}}


Icon + text or banner

This parameter will show an icon or a banner, depending on the combination of parameters. If it is invoked, there are 2 possible outcomes:

  1. Together with parameters |1 and, optionally, |2, the template will display a small Github icon followed by your link.
  2. Without parameters |1 and |2, it will instead show a small banner with the Github icon and the Mozilla wordmark. NB! This banner only links to Mozilla's project page on Github.
  • Any value you specify will be interpreted as "true", and invoke the parameter; i.e. |icon=yes will yield the same result as |icon=haggis.
  • {{gitlink|icon=yes}}


Banner size

It is possible to change the size of the banner. The value can be given in pixels (px) or em-units (em), use the decimal point for fractions.

  • This parameter is dependant on parameter |icon. If that isn't specified, the template will fall back to display the default, small banner link to Mozilla's project page.
  • There can't be any space character between the number value and its unit (px or em).
  • {{gitlink|size=number value + px/em}}


Case What you type What you see
No parameters {{gitlink}} Mozilla on Github
Link to project harthur}} harthur
Link to repository harthur/rainbow}} harthur/rainbow
Link + link text harthur/rainbow|Heather's colour tool}} Heather's colour tool
Icon + link harthur/rainbow|icon=yes}} Github's icon harthur/rainbow
Icon + link text harthur/rainbow|Heather's colour tool|icon=yes}} Github's icon Heather's colour tool
Banner icon=yes}} Mozilla on Github
Banner size icon=yes|size=x48px}} Mozilla on Github

See also