无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
<includeonly> | <includeonly> | ||
{{#if: {{{start|}}}| | {{#if: {{{start|}}}| | ||
<div class=" | <div class="home-grid"> | ||
|}} | |}} | ||
<templatestyles src="Template:首页/style.css" /> | |||
<templatestyles src="Template:卡片/Cards.css" /> | |||
<templatestyles src="Template:MCPlayerInfo/style.css" /> | <templatestyles src="Template:MCPlayerInfo/style.css" /> | ||
< | <!-- 修复:确保所有变量正确解析 --> | ||
< | <div class="home-card mc-player-card"> | ||
<div class="transport-card mc-player-avatar"> | |||
<div class="transport-image"> | |||
<a href="/wiki/{{{name|}}}" title="{{{name|}}}"> | |||
<img src="{{{image|https://picsum.photos/200/200?random=1}}}" | |||
alt="{{{name|}}}的头像" /> | |||
</a> | |||
</div> | |||
</div> | </div> | ||
<div class="mc-player-info"> | |||
<div class="mc-info"> | <h3 class="home-card__header"> | ||
< | <a href="/wiki/{{{name|}}}" title="{{{name|}}}" style="text-decoration: none;"> | ||
<div class="mc- | {{{name|未设置名称}}} | ||
<div class="mc- | </a> | ||
</h3> | |||
<div class="mc-player-chinese"> | |||
{{{chinese|未设置中文介绍}}} | |||
</div> | |||
<div class="mc-player-english"> | |||
{{{english|未设置英文介绍}}} | |||
</div> | |||
</div> | </div> | ||
</ | </div> | ||
{{#if: {{{end|}}}| | {{#if: {{{end|}}}| | ||
第27行: | 第42行: | ||
<noinclude> | <noinclude> | ||
== | == 玩家信息卡片模板(变量解析修复版)== | ||
确保所有模板变量正确解析,避免出现裸露代码。 | |||
== 核心修复点 == | |||
1. 为所有变量添加默认值(如 {{{name|未设置名称}}}) | |||
2. 为所有链接添加 title 属性,提高可访问性 | |||
3. 确保所有变量用三层花括号包裹({{{变量名}}}) | |||
4. 为所有图片添加 alt 属性,确保无障碍支持 | |||
== 使用方法 == | == 使用方法 == | ||
第37行: | 第58行: | ||
| english = Creator of Minecraft | | english = Creator of Minecraft | ||
| image = Notch_Avatar.png | | image = Notch_Avatar.png | ||
}} | }} | ||
{{MCPlayerInfo|end=1}} | {{MCPlayerInfo|end=1}} | ||
</noinclude> | </noinclude> |
2025年7月26日 (六) 00:11的版本
玩家信息卡片模板(变量解析修复版)
确保所有模板变量正确解析,避免出现裸露代码。
核心修复点
1. 为所有变量添加默认值(如 未设置名称) 2. 为所有链接添加 title 属性,提高可访问性 3. 确保所有变量用三层花括号包裹({{{变量名}}}) 4. 为所有图片添加 alt 属性,确保无障碍支持
使用方法
<a href="/wiki/" title=""> <img src="https://picsum.photos/200/200?random=1" alt="的头像" /> </a>
<a href="/wiki/" title="" style="text-decoration: none;"> 未设置名称 </a>
未设置中文介绍
未设置英文介绍
<a href="/wiki/Notch" title="Notch"> <img src="Notch_Avatar.png" alt="Notch的头像" /> </a>
<a href="/wiki/Notch" title="Notch" style="text-decoration: none;"> Notch </a>
马库斯·阿列克谢·泊松
Creator of Minecraft
<a href="/wiki/" title=""> <img src="https://picsum.photos/200/200?random=1" alt="的头像" /> </a>
<a href="/wiki/" title="" style="text-decoration: none;"> 未设置名称 </a>
未设置中文介绍
未设置英文介绍