This repository was archived by the owner on Nov 6, 2025. It is now read-only.
[v14.2+] Fix Block Grid layoutStylesheet not using correct URL #2512
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
14.3.1, but also affects 15.
Description
When configuring a
layoutStylesheetagainst a BlockGrid datatype, the path to the CSS isn't resolved correctly when the front end is built and included in the NuGet package for release. The URL it is trying to be loaded from includes the backoffice path as part of the URL.When running the Backoffice project locally,
appUrlwill always resolve tohttp://localhost:5173, whereas when running within the context of a C# project,appUrlwill resolve to the absolute backoffice path, e.g.https://localhost:44338/umbraco.Types of changes
Motivation and context
This is a secondary fix that attempts to resolve an issue not fully resolved in #2213. The backoffice URL does not need to be included in
appUrlin this context as all resources are likely to reside inwwwroot, which is then handled intransformServerPathToClientPath.Also see umbraco/Umbraco-CMS#16897.
Fixes the above linked issue so that BlockGrid layouts can be rendered correctly in the backoffice, and in Custom Views, with applied CSS.
This also fixes the same issue with Block icons.
How to test?
Will need to be tested against a built version of the backoffice running in a .NET project (unsure how to do this, sorry!)
Screenshots (if appropriate)
Unable to show screenshots as this only affects the built project when running on a .NET project
Checklist