Template:Github link/doc
From MozillaWiki
Usage
{{gitlink}} creates a link to a project or repository on Github.
Parameters
There are 4 parameters, 2 unnamed ad 2 named, none of which is strictly required.
Syntax
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
1
- 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.
- Notes
- 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.
- Usage
-
{{gitlink|1}}
2
- Custom link text
You can specify a custom link text if you like.
- Notes
- 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.
- Usage
-
{{gitlink|1|2}}
icon
- 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:
- Together with parameters
|1
and, optionally,|2
, the template will display a small Github icon followed by your link. - 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.
- Notes
- 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
.
- Usage
-
{{gitlink|icon=yes}}
size
- 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.
- Notes
- 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).
- Usage
-
{{gitlink|size=number value + px/em}}
Examples
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}} | harthur/rainbow |
Icon + link text | harthur/rainbow|Heather's colour tool|icon=yes}} | Heather's colour tool |
Banner | icon=yes}} | |
Banner size | icon=yes|size=x48px}} |
See also
- {{GithubToTravis}}