Hi @jstask ,
A stupid question, but have you registered the shortcode?
Thread Starter
Aaron
(@jstask)
Hey,
Sure I did. Otherwise, the short code won’t get executed inside the Gutenberg editor. Your question make me think you missed the important thing: This only happens if I don’t enter a meta description myself, and keep using the default one. As soon as I enter something, the shortcode works as expected.
I got it. I recorded a video on this case:
https://monosnap.com/file/khFS47zkyu7eLRXefdrA5mrlioRzhw
Just a note that shortcodes are not rendered in the preview, but when viewing on the frontend, it’ll rendered correctly.
Thread Starter
Aaron
(@jstask)
Hey @rilwis,
I rechecked and noticed two things:
- My own block: No preview inside meta description, but output in the meta-tag without short shortcode execution.
- The Core Paragraph Block Works as expected
I guess it is because I use render callbacks: my block is storing its content inside the block attributes and the safe function is returning null. If this approach is wrong when using render callbacks, I appreciate a hint 😉
Below are my block attributes in comparison to the core paragraph attributes
<!-- wp:aaronkessler/text {"size":"5xl","margin":"xl","customMargin":true,"tag":"h1","content":"\u003cmark class=\u0022mark bg-white\u0022\u003e\u003cspan class=\u0022mark-span bg-gradient-to-r from-primary-700 via-primary-500 to-primary-700 text-transparent bg-clip-text\u0022\u003eWebdesign\u003c/span\u003e\u003c/mark\u003e und Medien[shy]gestaltung","gradient":"Primary-Gradient","font":"Display","className":"mark-first-word","anchor":"heading"} /-->
<!-- wp:paragraph -->
<p>Medien[shy]gestaltung</p>
<!-- /wp:paragraph -->
I guess for the preview it is impossible to get it to work, because AFAIK there is no standard for block attribute names.
But since it is outputting the content without the shortcode execution inside the meta-tag, I guess there must be a way to fix it.
Thread Starter
Aaron
(@jstask)
Well, I rethought it and I do return something in my save component now that can be parsed.