Template:Article thumbnail: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
<templatestyles src="Article thumbnail/styles.css" />
<div class="article-thumb">
<div class="article-thumb__imgwrap">[[File:{{{image}}}|{{{width|180}}}px|link={{{page|{{BASEPAGENAME}}}}}|alt={{{alt|Thumbnail for {{{page|{{BASEPAGENAME}}}}}}}]]</div>
{{#ifexist: File:{{{image|work-in-progress-book.jpg}}}
| [[File:{{{image|work-in-progress-book.jpg}}}|{{{width|180}}}px|link={{{page|{{BASEPAGENAME}}}}}|alt={{{alt|Thumbnail for {{{page|{{BASEPAGENAME}}}}}}}]]
| [[File:work-in-progress-book.jpg|{{{width|180}}}px|link={{{page|{{BASEPAGENAME}}}}}|alt={{{alt|Thumbnail for {{{page|{{BASEPAGENAME}}}}}}}]]
}}
</div>
<div class="article-thumb__caption">[[{{{page|{{BASEPAGENAME}}}}}]]</div>
</div><noinclude>
Line 9 ⟶ 14:
 
== Parameters ==
* <code>image</code> – '''RequiredOptional.''' File name of the image '''without''' the <code>File:</code> prefix (e.g., <code>Atomic Habits cover.jpg</code>).
If the file is missing or not provided, it falls back to <code>work-in-progress-book.jpg</code>.
* <code>page</code> – Optional. Target page for the image link and caption. Defaults to <code>{{BASEPAGENAME}}</code>.
* <code>width</code> – Optional. Width passed to the file thumbnail ('''numeric only, no units'''). Defaults to <code>180</code>.
Line 61 ⟶ 67:
== Notes ==
* Provide the exact file name, including extension, but do not include the <code>File:</code> prefix in <code>|image=</code>.
* If the provided image file does not exist (or is omitted), this template automatically uses <code>work-in-progress-book.jpg</code>.
* The CSS fixes the card width (150&nbsp;px) and image area height (180&nbsp;px). The image is centered and constrained with <code>max-width:100%</code> and <code>max-height:100%</code>.
* For grid layouts, place multiple template calls on the same line or separated by spaces; each card is <code>display:inline-block</code> and will wrap as needed.