最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

block editor - How to edit a pattern per post while preventing Gutenberg from overwriting part of my HTML code

programmeradmin5浏览0评论

In the classic editor I had found a plugin with which I created customised templates to be added to each individual post and to be modified as needed, without losing anything: classes, attributes and properties.

In Gutenberg I created custom HTML code that I saved as a pattern, so that I could add it to each post as and when needed. The problem occurs when I change the pattern for the individual post because Gutenberg overwrites some of my custom HTML code.

For example, I create a block by adding custom HTML code for a custom button and then save it as a pattern, like this one:

<a href="#" target="_blank" class="btn">My anchor text</a>

When I create a new post and need my customised button, I search for the pattern, add it and display it correctly. But when I change the anchor text and the hyperlink, the HTML code changes like this:

<p><a href="; target="_blank" rel="noreferrer noopener">Go to the website</a></p>

My btn class is practically removed.

Is there any way to prevent this?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论