Template talk:Grid/Crafting
Why do images need specific filenames to work with this template?
This writeup is here so I can explain this sentence:
"Currently due to the way it's hardcoded it requires highly specific image filenames to work - this is under review and may change in the future."
Technically, this is not 100% true, but fixing it would break the template. Here's why.
Let us look at the template source code for images. I have inserted whitespace and comments for readability:
{{#if:{{{A1|}}} <!-- if the "A1" parameter exists, include everything below -->
<!-- create this div with these styling parameters -->
|<div style="left:14px; top:8px; width:40px; height:40px; position:absolute;">
[[Image:
<!-- if the "A1-image" parameter exists, use "A1-image" as the filename; otherwise, use Grid_(whatever A1 is).png -->
{{#if:{{{A1-image|}}}|{{{A1-image}}}|Grid_{{{A1}}}.png}}
<!-- the image is always 40px in size -->
|40px
<!-- if the "A1-link" parameter exists, use "A1-link" as the link; otherwise, link to (whatever A1 is) -->
|link={{#if:{{{A1-link|}}}|{{{A1-link}}}|{{{A1}}}}}
<!-- Alt text is whatever you entered as A1 -->
|alt={{{A1}}}
<!-- if "A1_name" exists, use it for the name, otherwise do not include it-->
|{{#if:{{{A1_name|}}}|{{{A1_name}}}}}
]]
</div>
}}
So ultimately the issue is that first line after [[Image:. If anyone were to use the A1-image parameter (or B1-image, B2-image, etc.) you could use whatever filename you wanted for that. That is not the problem.
So why would everything break if we removed "Grid_" from the image filenames?
The problem is that the vast, VAST majority of {{Grid/Crafting}} uses, do NOT use the "cell-image" parameter, and instead rely on the default value: Grid_(cell name).png. If you removed "Grid_" from the beginning of those filenames, every single one of those crafting grids would now be looking for a nonexistent page, breaking every single use of the grid.
So what's the solution?
The long term solution is to rewrite this template, ideally adopting a more-up-to-date approach for this grid-based approach (probably borrowing from something like the Minecraft wiki), in order to completely remove the default fallback to "Grid_cellname.png". This would be difficult, since comparable wikis have quite complicated systems of multiple templates used as "building blocks" for grid displays. In fact this seems to have been the original idea, but unfortunately for us, our copy seems to be not-quite-complete.
The immediate short term solution is to start using the A1-image (or A2-image, B1-image, whatever) parameter, if you want to use an image that does not start with "Grid_".
The actual problem is going from the short-term solution, to the long-term solution. Here's a couple of solutions that have been proposed in the past.
- Option A: Completely remove all files that begin with "Grid_" from the wiki, and change the default fallback to be
{{{cellname}}}.png - Option B: Move/rename all files that begin with "Grid_" to a different file, and make the "Grid_filename.png" page a redirect to the new file.
Both options require an enormous amount of work (which could be automated, technically) to perform. Both options will require an enormous amount of work to figure out what breaks, and fix those.
From my personal opinion, either one of those would work, we just need to figure out an automated solution to actually do it, then figure out a way to track where things break.
Summary: if you want to use a non-"Grid_" png file, use the cellname-image parameter. Anything more comprehensive is going to need a lot more work. -- Veerserif (talk here or on Discord) 17:32, 14 April 2025 (UTC)
