Skip to content

Use local placeholder images in the Bootstrap theme - #464

Open
daphneslootmans wants to merge 2 commits into
masterfrom
fix/local-placeholder-images
Open

daphneslootmans wants to merge 2 commits into
masterfrom
fix/local-placeholder-images

Conversation

@daphneslootmans

@daphneslootmans daphneslootmans commented Nov 2, 2026 •

Copy link
Copy Markdown

Summary

The Bootstrap theme's user templates and the Blog article fallback used external placeholder services. via.placeholder.com has shut down, so those placeholders no longer load.

  • Adds src/Layout/Images/image-placeholder.svg: a light grey 4:3 image with a simple sun-and-mountains shape, used for every photo slot regardless of its size.

  • Adds src/Layout/Images/icons/icon-placeholder.svg: a dashed 80×80 square for icon slots. Core has no icon placeholders yet, it is there for themes that need one.

  • Replaces all 9 external placeholder images:

    • img-fullwidth, image-l-image-r (2), image-l-text-r, text-l-image-r: via.placeholder.com
    • test.html: 3 placehold.it references (image, data-src, background url())
    • Blog Article.html.twig: the fallback for an article without an image, now {{ THEME_URL }}/Core/Layout/Images/image-placeholder.svg
  • Fixes copying a page that contains one of these placeholders: Add::getOriginalPage() copied every user template image that is not a full URL from the upload folder, so a theme asset made Filesystem::copy() throw. It now only copies images whose src is in Files/Pages/UserTemplate.

Ported from sumocoders-be-2026, where the same SVGs replace the placeholders in the Custom theme.

Test plan

  • No external placeholder URL left outside node_modules, vendor and built Core folders
  • twigcs on the Blog template: no violations
  • CI
  • Insert the full-width image user template in the page editor and check the placeholder shows
  • npm run build copies the SVGs to Core/Layout/Images
  • Copy a page that uses a user template with a placeholder image

🤖 Generated with Claude Code

Summary by Sourcery

Replace external Bootstrap theme placeholders with local assets and preserve theme placeholders during image processing.

New Features:

  • Add local SVG image and icon placeholders for the Bootstrap theme.

Bug Fixes:

  • Replace unavailable external placeholders in Bootstrap user templates and Blog article fallbacks with local assets.
  • Prevent theme asset placeholders from being treated as uploaded images during page processing.

The user templates and the Blog article fallback used placehold.it and
via.placeholder.com, which has shut down, so their placeholders no
longer loaded. They now point to a local image-placeholder.svg (4:3).
icon-placeholder.svg (dashed square) is added for icon slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The Bootstrap theme now uses repository-owned SVG placeholders for user-template photo slots and Blog article fallbacks, removing its dependency on unavailable or redirecting external placeholder services.

File-Level Changes

Change Details Files
Adds local SVG assets for photo and icon placeholders and updates Bootstrap references to use them instead of external placeholder services.
  • Adds a reusable light-grey 4:3 image placeholder SVG.
  • Adds a dashed 80×80 icon placeholder SVG for theme use.
  • Replaces external URLs in Bootstrap user templates, including image, data-src, and CSS background references.
  • Updates the Blog article image fallback to use the theme-served placeholder asset.
src/Frontend/Themes/Bootstrap/src/Layout/Images/image-placeholder.svg
src/Frontend/Themes/Bootstrap/src/Layout/Images/icons/icon-placeholder.svg
src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/img-fullwidth.html
src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-image-r.html
src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-text-r.html
src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/text-l-image-r.html
src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/test.html
src/Frontend/Themes/Bootstrap/Modules/Blog/Layout/Templates/Article.html.twig

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-image-r.html" line_range="3-6" />
<code_context>
 <div class="row my-5">
   <div class="col-md-6 mb-4 mb-md-0">
-    <img data-ft-label="Image" data-ft-type="image" src="https://via.placeholder.com/610x405.png" alt="Image alt text" class="img-fluid w-100" />
+    <img data-ft-label="Image" data-ft-type="image" src="/src/Frontend/Themes/Bootstrap/src/Layout/Images/image-placeholder.svg" alt="Image alt text" class="img-fluid w-100" />
   </div>
   <div class="col-md-6">
</code_context>
<issue_to_address>
**Copying pages with placeholders fails**

When a page containing one of these user templates is copied before its placeholder image has been replaced, `Add::getOriginalPage()` treats these non-HTTP image paths as uploaded user-template files, then `Filesystem::copy()` tries to copy `image-placeholder.svg` from the user-upload directory, where it does not exist, aborting the page copy.

Exclude theme asset paths from the uploaded-image copy logic, or otherwise preserve them without attempting to copy them from the user-upload directory.

Also at `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-text-r.html:3`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/img-fullwidth.html:3`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/test.html:3`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/text-l-image-r.html:10`.
</issue_to_address>

### Comment 2
<location path="src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/img-fullwidth.html" line_range="3" />
<code_context>
 <div class="row my-5">
   <div class="col-12">
-    <img src="https://via.placeholder.com/610x405.png" data-ft-label="Image" data-ft-type="image" alt="Image alt text" class="img-fluid w-100">
+    <img src="/src/Frontend/Themes/Bootstrap/src/Layout/Images/image-placeholder.svg" data-ft-label="Image" data-ft-type="image" alt="Image alt text" class="img-fluid w-100">
   </div>
 </div>
</code_context>
<issue_to_address>
**User-template placeholders appear broken**

When the deployment serves built theme assets from Core but does not expose the source tree, the template image URLs point to the source-tree path, which the deployment does not serve, so the browser cannot load the placeholders.

Point both template images at the built theme assets under Core/Layout/Images.

Also at `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-image-r.html:3-7`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-text-r.html:3`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/test.html:3-6`, `src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/text-l-image-r.html:10`.
</issue_to_address>

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/image-l-image-r.html:6, src/Frontend/Themes/Bootstrap/src/Layout/Templates/UserTemplates/img-fullwidth.html:3


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Copying a page copied every user template image that is not a full URL
from the upload folder. Theme assets such as the new local placeholders
are not in that folder, so Filesystem::copy() threw and the copy failed.
Images outside the upload folder now stay as they are.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants