Conversation
…ckoffice document routes.
bjarnef
reviewed
Mar 17, 2025
| if (Guid.TryParse(pageId, out Guid pageIdAsGuid)) | ||
| { | ||
| return umbracoContext.Content?.GetById(true, pageIdAsGuid); | ||
| } |
Contributor
There was a problem hiding this comment.
@AndyButland would it be better to have Guid.TryParse first.. if page id is Guid there is no reason trying parsing to int.
if (Guid.TryParse(pageId, out Guid pageIdAsGuid))
{
return umbracoContext.Content?.GetById(true, pageIdAsGuid);
}
if (int.TryParse(pageId, NumberStyles.Integer, CultureInfo.InvariantCulture, out int pageIdAsInt))
{
return umbracoContext.Content?.GetById(true, pageIdAsInt);
}
I guess int is mainly for legacy/fallback.
Contributor
Author
There was a problem hiding this comment.
Actually int is the expected case. For 13 back-office routes use integers.
Contributor
There was a problem hiding this comment.
Yes, and it will continue to that as well, but it pageId is already Guid it won't try parsing to int.
But I see your point as most backoffice routes in v13 are using int id, besides linking in custom extension or packages e.g.
Contributor
There was a problem hiding this comment.
It also never fully supported Guid in v13 😅
#15289
Migaroez
approved these changes
Mar 18, 2025
This was referenced Sep 30, 2025
This was referenced Dec 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prerequisites
Fixes: #16129
Description
Seems we do support backoffice routes using GUIDs in Umbraco 13, so this fixes an issue reported when making use of this with macro rendering. I've amended the request to accept either a GUID or an integer when looking up the content the macros is rendering on.
To Test: