Template:CS/products/card: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
<templatestyles src="CS/products/card/styles.css"/> |
<templatestyles src="CS/products/card/styles.css"/> |
||
<div class="capsach-card capsach-align-{{#switch:{{lc:{{{align|left}}}}}|center=center|right=right|#default=left}}"> |
<div class="capsach-card capsach-align-{{#switch:{{lc:{{{align|left}}}}}|center=center|right=right|#default=left}}"> |
||
<div class="capsach-card__media"> |
|||
| ⚫ | |||
<span class="capsach-card__ratio"></span> |
|||
| ⚫ | |||
<div class="capsach-card__cta">{{CS button |
|||
{{#if:{{{img|}}} |
|||
| ⚫ | |||
| [[File:{{{img}}}|frameless|alt={{{alt|Product image}}}|link={{#if:{{{link|}}}|{{{link}}}|{{{url|}}}}}]] |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
}} |
|||
| ⚫ | |||
</div> |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
<div class="capsach-card__cta">{{CS button |
|||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
| ⚫ | |||
</div> |
</div> |
||
<noinclude> |
<noinclude> |
||
{{Documentation}} |
{{Documentation}} |
||
;Template: CS/products/card |
;Template: CS/products/card |
||
Minimal promo card: **Image → CTA button**. Fixed width at 300px; media area uses a 2:3 (w:h) portrait frame. |
|||
== Parameters == |
== Parameters == |
||
| Line 43: | Line 37: | ||
== Behavior == |
== Behavior == |
||
* Image links are created via the file syntax’s <code>link=</code> parameter |
* Image links are created via the file syntax’s <code>link=</code> parameter (internal link preferred over external). If both are empty, the image is non‑clickable. |
||
* Card width is fixed at 300px; media area is 450px tall (2:3). The image fills the frame and crops as needed. |
|||
* Card is 100% width on mobile and up to 480px on larger screens. |
|||
* CTA uses {{tl|CS button}} with <code>mobile=full</code> and <code>width=100%</code>. |
|||
* Media area enforces a **2:3 (w:h) aspect ratio**; the image fills and crops as needed. |
|||
* If neither <code>link</code> nor <code>url</code> is provided, media is non‑clickable and the CTA renders as a non‑link (per {{tl|CS button}} behavior). |
|||
== Example == |
== Example == |
||
| Line 58: | Line 51: | ||
== Troubleshooting == |
== Troubleshooting == |
||
* ** |
* **Anchor showing oddly**: do not add raw <code><a></code>; the template sets the image link via <code>link=</code>. |
||
* **Image not full width**: |
* **Image not full width**: pass only the filename (no <code>File:</code> namespace) and no explicit size; CSS handles sizing/cropping. |
||
* **No image available**: omit <code>img</code> to get the neutral placeholder (still sized 2:3). |
|||
</noinclude> |
</noinclude> |
||
Revision as of 17:04, 26 October 2025
Check out on Etsy
- Template
- CS/products/card
Minimal promo card: **Image → CTA button**. Fixed width at 300px; media area uses a 2:3 (w:h) portrait frame.
Parameters
| Parameter | Required | Default | Notes |
|---|---|---|---|
url |
yes* | — | External URL. Required unless link is provided.
|
link |
no | — | Internal wiki link. If set, it takes precedence over url.
|
img |
no | — | Image filename (without File:). If missing, a neutral placeholder is shown.
|
button |
no | Check out on Etsy |
CTA button text (passed to {{CS button}}). |
align |
no | left |
One of left · center · right.
|
alt |
no | Product image |
Alt text for accessibility. |
Behavior
- Image links are created via the file syntax’s
link=parameter (internal link preferred over external). If both are empty, the image is non‑clickable. - Card width is fixed at 300px; media area is 450px tall (2:3). The image fills the frame and crops as needed.
- CTA uses {{CS button}} with
mobile=fullandwidth=100%.
Example
{{CS/products/card
| url=https://etsy.com/
| img=AtomicHabits.png
| button=Check out on Etsy
}}
Troubleshooting
- **Anchor showing oddly**: do not add raw
<a>; the template sets the image link vialink=. - **Image not full width**: pass only the filename (no
File:namespace) and no explicit size; CSS handles sizing/cropping.