Hello folks,
I’m trying to build a section template that allow me take a list of files and provide download links for them.
Each content file will have different combinations of those links. At this time, I’m doing something like this:
docs_url: "http://server.com/file-doc.7z"
docs_size: "4.8MB"
docs_md5: "md5123"
docs_sha256: "sha256"
installer_x64_md5: "md5123"
installer_x64_sha256: "sha256"
installer_x64_size: "17MB"
installer_x64_url: "http://server.com/installer-x64.exe"
installer_x86_md5: "md5123"
installer_x86_sha256: "sha256"
installer_x86_size: "17MB"
installer_x86_url: "http://server.com/installer.exe"
package_x64_md5: "md5123"
package_x64_sha256: "sha256"
package_x64_size: "9.4MB"
package_x64_url: "http://server.com/package-x64.7z"
package_x86_md5: "md5123"
package_x86_sha256: "sha256"
package_x86_size: "9.9MB"
package_x86_url: "http://server.com/package.7z"
As you can see, I have different combinations for items, which makes really hard to stay DRY defining those download elements.
I was looking into ways to have a more structured version:
files:
- title: "Installer (x86)"
type: "installer"
size: "17MB"
url: "http://server.com/installer.exe"
md5: "abc123"
sha256: "sha256"
- title: "Binary (x86)"
type: "binary"
url: "..."
But Hugo (I believe is due YAML parsing support in Go) refuses to recognize that structure and .Params.files
returns empty.
Do you suggest any alternative to avoid having to define code for all the links?
Thank you in advance for your suggestions.