congo
congo copied to clipboard
fix: add image fix
- [x] fix: fix img flip
- [ ] test: test with image (No image to test)
Please let me know if anyone has an image to test
Closes #600
Deploy Preview for hugo-congo ready!
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | 1b7361c50db31f2e601aad787254e386a7bf0e1e |
Latest deploy log | https://app.netlify.com/sites/hugo-congo/deploys/6565e82f4b4e5f00082aceb4 |
Deploy Preview | https://deploy-preview-726--hugo-congo.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
You can do something like this, to reduce repetition
{{ $s := newScratch }}
{{ $s.SetInMap "sizes" "330w" 330 }}
{{ $s.SetInMap "sizes" "660w" 660 }}
{{ if gt .Width 1024 }}
{{ $s.SetInMap "sizes" "1024w" 1024 }}
{{ end }}
{{ if gt .Width 1320 }}
{{ $s.SetInMap "sizes" "2x" 1320 }}
{{ end }}
{{ if le .Width 1320 }}
{{ $s.SetInMap "sizes" (printf "%dw" .Width) .Width }}
{{ end }}
...
srcset="
{{ range $key, $size := $s.Get "sizes" }}
{{ ($img.Resize (printf "%dx webp %s" $size $rotation)).RelPermalink }} {{ $key }},
{{ end }}"
srcset="
{{ range $key, $size := $s.Get "sizes" }}
{{ ($img.Resize (printf "%dx %s" $size $rotation)).RelPermalink }} {{ $key }},
{{ end }}"
to reduce repetition
You can do something like this, to reduce repetition
{{ $s := newScratch }} {{ $s.SetInMap "sizes" "330w" 330 }} {{ $s.SetInMap "sizes" "660w" 660 }} {{ if gt .Width 1024 }} {{ $s.SetInMap "sizes" "1024w" 1024 }} {{ end }} {{ if gt .Width 1320 }} {{ $s.SetInMap "sizes" "2x" 1320 }} {{ end }} {{ if le .Width 1320 }} {{ $s.SetInMap "sizes" (printf "%dw" .Width) .Width }} {{ end }} ... srcset=" {{ range $key, $size := $s.Get "sizes" }} {{ ($img.Resize (printf "%dx webp %s" $size $rotation)).RelPermalink }} {{ $key }}, {{ end }}" srcset=" {{ range $key, $size := $s.Get "sizes" }} {{ ($img.Resize (printf "%dx %s" $size $rotation)).RelPermalink }} {{ $key }}, {{ end }}"
to reduce repetition
Thanks for the suggestion. I am still new to hugo and have to read up on how this works first before implementing it ><
I think an issue with this implementation is that it's only dealing with one orientation. Ideally this needs to handle all the possible values and rotate the image accordingly.
This pull request has been automatically marked as stale because it has not had any recent activity. Please review the PR history and add a reply with any requested information. If no information has been requested, it may be that this contribution does not fit with the project objectives, or does not adhere to the contributing guidelines. If this is in error, please add a reply with further details. This PR will automatically close in 30 days if no further activity occurs.