This is an automated email from the ASF dual-hosted git repository.
paulk-asert pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 8ec1ad3 fix broken images
8ec1ad3 is described below
commit 8ec1ad39172fec553bf9d10380e368e90431c189
Author: Paul King <[email protected]>
AuthorDate: Sat May 30 09:44:27 2026 +1000
fix broken images
---
generator/src/main/groovy/generator/SiteGenerator.groovy | 16 +++++++++++++---
site/src/site/pages/blog.groovy | 14 +++++++++-----
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/generator/src/main/groovy/generator/SiteGenerator.groovy
b/generator/src/main/groovy/generator/SiteGenerator.groovy
index 40b740f..e5d8ad1 100644
--- a/generator/src/main/groovy/generator/SiteGenerator.groovy
+++ b/generator/src/main/groovy/generator/SiteGenerator.groovy
@@ -293,10 +293,20 @@ class SiteGenerator {
// source tree clean; the convert() call below also
// sets it (via the blog.groovy template) so the actual
// <img> reference resolves at output time.
- def blogImgDir = new File(outputDir, baseDir + File.separator
+ 'img')
+ //
+ // imagesoutdir is the blog *page* output dir and imagesdir
+ // is '.', so neither is prepended to an image target: both
+ // hand-authored macros (image:img/foo.png) and diagram
+ // blocks ([plantuml,img/Foo,svg]) carry the 'img/' prefix
+ // themselves. That keeps the written file and the emitted
+ // <img> reference in agreement at blog/img/… — setting
+ // imagesoutdir at blog/img/ instead would write diagrams to
+ // blog/img/img/… while the reference still points at
blog/img/.
+ def blogPageDir = new File(outputDir, baseDir)
+ def blogImgDir = new File(blogPageDir, 'img')
blogImgDir.mkdirs()
def attrs = Attributes.builder()
- .attribute('imagesoutdir', blogImgDir.absolutePath)
+ .attribute('imagesoutdir', blogPageDir.absolutePath)
.attribute('imagesdir', '.')
.build()
// SafeMode.UNSAFE lets asciidoctor-diagram write to
@@ -313,7 +323,7 @@ class SiteGenerator {
blogList[bn] = doc
contents[bn] = f.getText('utf-8')
baseDirs[bn] = baseDir
- imageDirs[bn] = blogImgDir.absolutePath
+ imageDirs[bn] = blogPageDir.absolutePath
}
}
Map<String, Set> keywords = [:]
diff --git a/site/src/site/pages/blog.groovy b/site/src/site/pages/blog.groovy
index bf18a74..660b09f 100644
--- a/site/src/site/pages/blog.groovy
+++ b/site/src/site/pages/blog.groovy
@@ -29,12 +29,16 @@ layout 'layouts/main.groovy', true,
mainContent: contents {
// imagesoutdir tells asciidoctor-diagram where to write
// generated images (e.g. from [plantuml,…] blocks) — it
- // points at blog/img/. imagesdir is '.' so it is not
- // prepended to image targets: pre-rendered blog images
- // already carry the `img/` prefix in their macros, and
+ // points at the blog *page* dir (blog/…). imagesdir is '.'
+ // so it is not prepended to image targets: pre-rendered blog
+ // images already carry the `img/` prefix in their macros, and
// diagram blocks supply it via their target (e.g.
- // [plantuml,img/WordCount,svg]). Anything other than '.'
- // here double-prefixes the pre-rendered images (img/img/…).
+ // [plantuml,img/WordCount,svg]). Both the written file and the
+ // emitted <img> reference therefore resolve at blog/img/….
+ // Anything other than '.' here double-prefixes the pre-rendered
+ // images (img/img/…); pointing imagesoutdir at blog/img/ instead
+ // writes diagrams to blog/img/img/… while the reference still
+ // points at blog/img/ — see generator's SiteGenerator.groovy.
Map options = [attributes:[
DOCS_BASEURL: DocUtils.DOCS_BASEURL,
imagesoutdir: imagesoutdir,