Solved How can I scale an image in a Hugo page
-
@JaredBusch said in How can I scale an image in a Hugo page:
and the new shortcode
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="100px" class="about-left" >}}
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
<img src="/images/dwarf1.jpg" alt="dwarf" width="100" class="about-left">
In html when you provide
width
orheight
it's enough to do one of them and then that become the constraining factor and the image keeps it's aspect ratio.. -
@Pete-S said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
and the new shortcode
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="100px" class="about-left" >}}
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Huog is all markdown based, and depending on the theme (apparently) you cannot jsut use html in a page.
-
@Pete-S said in How can I scale an image in a Hugo page:
In html when you provide width or height it's enough to do one of them and then that become the constraining factor and the image keeps it's aspect ratio..
Yes
-
ok issue with the shortcode. it makes each image on it's own line, even though I have it all on one line.
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="200px" >}} {{< figure src="/images/c64.jpg" alt="c64" width="200px" >}} {{< figure src="/images/tower.jpg" alt="computer tower" width="200px" >}}
Inspect element:
View Source:
View source shows the three images appear to be wrapped in a single
<p>
Visible output:
-
@Pete-S said in How can I scale an image in a Hugo page:
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Here is an example.
This:
Results in this:
-
I don't get where you are putting the shortcode where you define the image file.
-
@Obsolesce said in How can I scale an image in a Hugo page:
I don't get where you are putting the shortcode where you define the image file.
In the page/post of course.
In this case
about.md
-
@JaredBusch said in How can I scale an image in a Hugo page:
@Pete-S said in How can I scale an image in a Hugo page:
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Here is an example.
This:
Results in this:
So "This:" is the
about.md
file, where you have both the html img line and shortcode? -
@Pete-S said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
and the new shortcode
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="100px" class="about-left" >}}
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
<img src="/images/dwarf1.jpg" alt="dwarf" width="100" class="about-left">
In html when you provide
width
orheight
it's enough to do one of them and then that become the constraining factor and the image keeps it's aspect ratio..The shortcodes vary depending on what they are. Here's the youtube shortcode to embed a youtube video:
{{< youtube w7Ft2ymGmfc >}}
-
@JaredBusch said in How can I scale an image in a Hugo page:
So, Hugo has a built in short code for this...
https://gohugo.io/content-management/shortcodes/#example-figure-input
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="100px" >}}
I missed that somehow, my bad.
-
@Obsolesce said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
@Pete-S said in How can I scale an image in a Hugo page:
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Here is an example.
This:
Results in this:
So "This:" is the
about.md
file, where you have both the html img line and shortcode?Oh, FFS. The image tag was only there to show him what happens to HTML. Pay attention.
-
@stacksofplates said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
So, Hugo has a built in short code for this...
https://gohugo.io/content-management/shortcodes/#example-figure-input
{{< figure src="/images/dwarf1.jpg" alt="dwarf" width="100px" >}}
I missed that somehow, my bad.
I never found it when searching either.
-
@JaredBusch said in How can I scale an image in a Hugo page:
@Obsolesce said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
@Pete-S said in How can I scale an image in a Hugo page:
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Here is an example.
This:
Results in this:
So "This:" is the
about.md
file, where you have both the html img line and shortcode?Oh, FFS. The image tag was only there to show him what happens to HTML. Pay attention.
Yeah, I figured. Nothing wrong with verifying something that looks contradicting, though. There's not enough of that around here tbh, too much assumption.
-
@Obsolesce said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
@Obsolesce said in How can I scale an image in a Hugo page:
@JaredBusch said in How can I scale an image in a Hugo page:
@Pete-S said in How can I scale an image in a Hugo page:
Just an observation but I wonder what the "shortcode" is short for, when it's basically exactly the same as html?
Here is an example.
This:
Results in this:
So "This:" is the
about.md
file, where you have both the html img line and shortcode?Oh, FFS. The image tag was only there to show him what happens to HTML. Pay attention.
Yeah, I figured. Nothing wrong with verifying something that looks contradicting, though. There's not enough of that around here tbh, too much assumption.
Okay, I’ll give you that.