SeoToolKit Programmatically Generating Meta Tags i...
# help-with-umbraco
s
I am using SeoToolKit and Umb v13. I have a multi-site setup where staff bios are being shared. I created a shell page that gets the staff member data from an ID on the route. The issue I keep running into is that the SeoToolKit is throwing missing object errors when loading. When I remove the tag helpers, the page will load fine. I am wondering if there is someone who knows the SeoToolKit package better and can tell me how to populate SEO tags from the Umbraco Page Controller.
p
Hi! Creator of SeoToolkit here 🙂 So you implemented the tag helper but it throws an error when trying to load the page?
s
Hey, the perfect resource, then! lol Ok so yes it will throw this error: "NullReferenceException: Object reference not set to an instance of an object. SeoToolkit.Umbraco.MetaFields.Core.Common.TagHelpers.MetaFieldsTagHelper.Process(TagHelperContext context, TagHelperOutput output)" For more details, the is in a master template.
p
Do you have access to the full stacktrace? And do you have any custom code in place that connects to SeoToolkit?
When I comment out the helper, the page will load without issue.
p
Hmm, that is super strange as there isn't much that can go wrong in that class (https://github.com/patrickdemooij9/SeoToolkit.Umbraco/blob/8c48a6588a17be02a5132cdc4e4941fe197e1c44/src/SeoToolkit.Umbraco.MetaFields.Core/Common/TagHelpers/MetaFieldsTagHelper.cs#L9) I noticed that you mentioned Umbraco Page Controller. What do you mean with that? Is that using the RenderController from Umbraco?
s
I am using a composer to create a route path: /about/team/{id}. There is a node at /about/team/bio in the back office. Essentially, I'm using the custom route and an UmbracoPageController/IVirtualPageController to go and find the team member data to populate the bio "shell". For example: /about/team/eric-engle will render a page with my bio. My thinking is that since that is technically a custom route, i might be needing to generate either the taghelpercontext or output in the controller. I have not figured how to do that or if its even possible.
p
Ah oke, I'll try to see if I can reproduce the issue by using the IVirtualPageController (bit later today, as I am still at work). If I can, then I will make sure to write a fix for it in the package
s
Sure thing! I am very grateful for any help you're willing to provide.
p
I've been able to reproduce the issue. I also did some digging and it seems to be an issue within Umbraco itself: https://github.com/umbraco/Umbraco-CMS/issues/12834. I did however find a workaround for it. I just pushed a new version for SeoToolkit (3.6.1) which has this workaround. Could you check if this fixes your issue?
s
Good morning. I took the update, and I am still getting the same error. I'll try to rework my code to fit the Umbraco fix better to make sure that's not an issue.
I was able to get it to work. I had to fix the Umbraco portion. Thank you so much for helping out!
22 Views