Skip to content

[5.x] Hack in namespace so statamic gets the correct blueprint#148

Merged
royduin merged 3 commits intomasterfrom
Jade-GG-patch-1
Jul 22, 2025
Merged

[5.x] Hack in namespace so statamic gets the correct blueprint#148
royduin merged 3 commits intomasterfrom
Jade-GG-patch-1

Conversation

@Jade-GG
Copy link
Copy Markdown
Collaborator

@Jade-GG Jade-GG commented Jul 18, 2025

When getting the entry directly like here, Statamic doesn't find the right blueprint because it only looks in the collections/[handle] folder. This is hardcoded within Statamic so there's no easy way around that. This means that all category pages and product pages in the frontend (not the backend) currently break due to there being no blueprint attached to them, giving you raw data instead of augmented data.

However, we can trick statamic into looking elsewhere by setting a custom namespace like this. It's a pretty gross hack, I don't like it. But it's the only thing I found that works.

We have to make sure it doesn't run when in the backend because otherwise it will show the extra blueprints from these hacky namespaces.

BobWez98
BobWez98 previously approved these changes Jul 18, 2025
kevinmeijer97
kevinmeijer97 previously approved these changes Jul 18, 2025
@Jade-GG Jade-GG dismissed stale reviews from kevinmeijer97 and BobWez98 via 7fc9b7d July 18, 2025 11:41
@Jade-GG Jade-GG requested a review from royduin July 18, 2025 11:43
@royduin
Copy link
Copy Markdown
Member

royduin commented Jul 22, 2025

This wasn't an issue earlier, maybe something changed in Runway? Maybe better to fix it there?

@Jade-GG
Copy link
Copy Markdown
Collaborator Author

Jade-GG commented Jul 22, 2025

This wasn't an issue earlier, maybe something changed in Runway? Maybe better to fix it there?

I tried with the oldest version of runway and statamic that this package allows and it still did not work. So I don't know if it really was not an issue earlier.

As far as I can tell, this issue stems from Statamic essentially hardcoding the collection blueprint path right here. Given that this has been in the Statamic source code for at least 5 years and there doesn't seem to be any way to hook into any part of this (that I could find) I would be very surprised if it had worked in the past.

@BobWez98
Copy link
Copy Markdown
Member

I'd say merge this and create a follow-up story to research other solutions.

@royduin royduin merged commit 4202628 into master Jul 22, 2025
@royduin royduin deleted the Jade-GG-patch-1 branch July 22, 2025 08:28
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.

4 participants