-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow MetaFields mapping to use RichText and Content Blocks etc. #114
Comments
Hi @robertjf It is possible to do this in code through one of the notifications: https://seotoolkit.gitbook.io/useotoolkit/extensions/notifications#beforemetatagsnotification. But if you have a suggestion for how it would work, then that would be great! |
Hey @patrickdemooij9, As a ContentBlock model is a structured json object, we can iteratively walk through the blocks looking for certain property types (after all, they are just IPublishedElements) and aggregate the first text strings that we find (including Rich text) until we have enough to satisfy the length of the meta field (title or description), truncating the rest. This way, it wouldn't matter what the structure or layout of the blocks is at all - we can only take a best-guess as to what the editor is trying to convey in the page anyway :) |
Just so to double-check that we are thinking about the same thing. If we have a page with a property (ContentBlock) called 'content' and the content of 'content' looks like this:
We could have a way to select the first hero block with a special syntax (dunno if this is the best way to do it, but it'll work for this example). Something like content.Hero[0].Title, which will get the first Hero block in the Is this what you were thinking about? I think this would be quite cool, although making an interface for this might be a bit troubling but I am sure that can be done. |
hey @patrickdemooij9, I'd probably keep it simpler than that - while that would be cool, and possibly a future enhancement, for now perhaps we just walk the json tree looking for any property that represents a textstring / textbox / richtext and keep aggregating the content into a string (stripping html as we go) until we have enough content. A slight enhancement for this would be to nominate what property types to look for the content in perhaps - that way you could use the same BlockList for both a title and a description field, and specify the Title uses a textstring, while the Description uses the RichText/Textbox... additional work would be necessary though in that the raw BlockList model doesn't expose the property type, just the alias and value. |
Yeah, that would probably be best for a first version, but it is good to hear that we are thinking about the same thing here 😊 I am sure I'll pick it up the future as well, but pull requests are always appreciated too! |
yep, will see what I can do 👍🏻 |
…rich text values from a block list or grid for description meta fields
At the moment, the pull request only looks at top-level block list/grid items and extracts any text / text area / tinymce content it finds. It should probably also truncate the result based on a configurable value, but doesn't yet. |
@patrickdemooij9 any idea on when you're likely to schedule a release? Itching to get these changes into production... |
Took a bit longer than expected, but it is out now: https://github.com/patrickdemooij9/SeoToolkit.Umbraco/releases/tag/3.4.0. Thanks again for your help on this! |
Currently when I configure the Meta Fields for a Document Type, the only properties that are showing up for mapping are TextString and TextArea type fields.
It would be great if we could map RichText and ContentBlock properties as well - particularly for the Meta/Social Description - in this case, SeoToolkit should extract the content and strip any html etc.; looking specifically for rich text/text properties and use the first one that it finds, truncating the rest.
The text was updated successfully, but these errors were encountered: