⧼social-icons-mobile-buttons⧽

Template:ColTilesRemote: Difference between revisions

From Tsadra Commons
(imagefile= through filepath + Widget:RemoteImage)
(VSCode edit)
 
Line 1: Line 1:
<includeonly><!--
<includeonly>{{#ifeq: {{{#userparam|}}} | rtz.tsadra.org ||{{SiteTile
One row of cards, one per Tibetan collection wiki, rendered here and shown
on every collection site. It lives on commons so the list is written ONCE:
a new collection going live is one edit here, not one edit per wiki.
 
It is fetched with an #ask carrying source=commons, and a remote #ask
resolves its row template on the SOURCE wiki -- so both this page and
Template:SiteTile have to be here, and so do the images.
 
The calling site passes its own hostname as userparam. It arrives under the
HASH-PREFIXED name -- see the documentation below; the plain name and the
numbered slots are never set. Each card compares it against its own host=
and renders nothing when they match, so a site never advertises itself. A
caller that passes nothing gets all four.
 
No braces in this comment: the preprocessor counts them even inside one, so
a triple-brace parameter named here leaves an unbalanced opener and
swallows the rest of the template. That is exactly what happened when this
page was first written -- it rendered four tiles as raw text and zero when
transcluded.
 
Add a collection by adding a SiteTile call. Upload its image HERE, on
commons, and name it with imagefile= -- a bare file name, no File: prefix
and no brackets.
 
That matters. A File: link is resolved against whichever wiki the markup
lands on, and this wiki's thumbnails are /thumb.php?f=... paths that 403
anywhere else. imagefile= goes through filepath:, which resolves here where
the file is native and returns an absolute URL at the right width, and then
through Widget:RemoteImage, whose output is not sanitised and so can carry
a real img tag. With no image the card falls back to the title's letter.
-->{{#ifeq: {{{#userparam|}}} | rtz.tsadra.org ||{{SiteTile
|url=https://rtz.tsadra.org
|url=https://rtz.tsadra.org
|name=Rinchen Terdzö
|name=Rinchen Terdzö

Latest revision as of 12:28, 14 September 2026

The cards for Tsadra's Tibetan collection wikis, written once and shown on all of them.

Each collection site renders this row with:

{{#ask:[[Template:ColTilesRemote]]
	|source=commons
	|format=template
	|template=ColTilesRemote
	|link=none
	|userparam={{SERVERNAME}}
}}

Passing commons.tsadra.org is what stops a site advertising itself: the value arrives as {{{#userparam}}} and each card compares it with its own host=.

To add a collection, add a {{SiteTile}} call above, wrapped in the same #ifeq. Upload its image here, not on the collection wiki — a remote #ask resolves everything on this wiki.

Pass the image as |imagefile=NAME.jpg — a bare file name, never image= and never a File:… link.

A File: link is resolved against whichever wiki the markup ends up on, and this wiki sets $wgThumbnailScriptPath, so its thumbnails are site-relative /thumb.php?f=… paths that return 403 anywhere else — every image in the row would break. imagefile= instead goes through {{filepath:}}, which runs here where the file is native and yields an absolute URL at the right width, and then through {{RemoteImage}} — a Widget, because its output escapes the sanitiser: in running text MediaWiki autolinks a bare URL, and a raw <img> written in wikitext is escaped.

Note {{{#userparam}}} is hash-prefixed. {{{userparam}}} and the numbered slots are never set; this was tested against a remote query before the template was written.