Skip to content

ssite --host doesn't fix <img> urls (or they shouldn't need fixing) #70

@eichin

Description

@eichin

(Tests with 2.4-1 as packaged on Ubuntu 24.04/noble.)

I start with an index.md with site_url: https://ssite-bug-t1.thok.org and template: blog.html (and the other basic bits from the howto for a simple blog.) Then I run ssite show --debug --host bug1.localhost to get a name to bind to (that happens to be a localhost name, at least as far as the browser is concerned.)

If I write a post1.md and then run convert -background lightblue -fill blue -font AvantGarde-Book -pointsize 72 label:post1 post1.jpg to generate a magic-image-for-post, I get <img alt='' srcset='/post1-thumbnail.jpg 128w, /post1.jpg 189w' src='/post1.jpg'></img> which are all relative, so that's fine (though neither a # nor a metadata title appear in the alt=, that's probably another ticket.

If I create a similar post2.md but with lightred.jpg as the image file, and then ![lightred](lightred.jpg) to explicitly include it (as I would when I want them in specific parts of the text, or simply to have more than one), I instead get <img alt="" src="https://ssite-bug-t1.thok.org/lightred.jpg" srcset="https://ssite-bug-t1.thok.org/lightred-thumbnail.jpg 128w, /lightred.jpg 471w"> Note that this does happen to render because the screen I'm using is wider than 471 (and the image-magick-generated image is 471x94) but the src and the rest of the srcset don't work - in fact, if I resize the browser (using inspect) down to 114 pixels wide, the image vanishes and the console shows GET https://ssite-bug-t1.thok.org/lightred-thumbnail.jpg net::ERR_NAME_NOT_RESOLVED.)

It is possible from the wording in the man page that --host isn't supposed to do rewriting at all, and is just about letting you share on a local network or something - in that case, it's not about fixing them, it's about "inline images shouldn't get site_url added to them" instead.

(For background: I'm pretty sure that what I really want is for the inline images to be class=img-fluid like they are for magic-name images, except in the above example I can't reproduce that in the index or post pages, even though the <figure ... ml-3 is getting generated.)

(Also, no additional template or .staticsite.py or settings.py, these are just defaults - but show doesn't obey those anyway since it's a Command not a SiteCommand.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions