Using `printf` with `resources.Get`

:laughing: Actually, my real repo (GitHub - brycewray/hugo_site: This is the repository from which the Hugo-generated version of https://www.brycewray.com is built.) has it now.

Note: For those following the above thread and wondering why I can’t easily implement the advice I was given, the problem is that I am also keeping each “title” file — what’s being overlaid in each case — separately on my local drive apart from the repo, hence the additional need to maintain separate files with unique filenames. Moreover: the whole point of this was to give me more control over the OG/Twitter card’s appearance. I used Hugo’s built-in text filter for a while, which is much simpler from a coding standpoint — but, at this writing, it doesn’t allow control over the overlaid text’s alignment (left-align only), its right-side padding (x-start and y-start only), or its word-breaking. …Hence, what I’ve done here. If those features ever get added to the text filter, it’ll be far and away a better choice.

Further edit from the next day: Also for those who find this thread later, I reconsidered the (as-always) excellent advice of @jmooring and decided to re-build my site that way. (At this writing, I’m finishing that up in a branch, but things are going well enough that I’ll probably merge it into main later today.) He’s absolutely right that it is far less error-prone and, as an added benefit, makes the coding much simpler.

1 Like

Pretty cool. So the Text function will just do a single line then with no wrapping or anything

1 Like

No, it wraps — but you have no control over the wrap. You end up with stuff like this:

This is a post about
Hugo

…instead of (adding simulated center-alignment, too):

This is a post
  about Hugo

This might help

1 Like

Thanks. Actually, by the time I saw your reply, I had already done it manually in a branch :grinning: — but this is still helpful info!

Later update: Have merged and pushed all the changes; I then wrote about the experience (with numerous links to this discussion):

1 Like

I haven’t converted mine yet. Only a few. Initially, I wanted to keep my files as I used them in Jekyll in case I wanted to switch platforms (I was trying Hugo, Eleventy and Zola). But since I settled on Hugo, I am still thinking about converting all files to page bundles (nearly 300). So, I am still not converting mine until I decide to do so in the future.

1 Like

It definitely was a multi-hour project, but the resulting templating is much less finicky to manage, just as @jmooring advised.

1 Like

Indeed! All my posts with images are page bundles. Page resources are a bliss!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.