Thanks again for all the help from this forum. I was wondering if there was a standard practice for adding React components into my wordpress posts. Basically, I’d like some equivalent to shortcode that I can easily detect within my Frontity site and place the appropriate React component where indicated by the author. These components could be a prompt to write a comment or a rating star array or some other component that the article author can decide the best place to put them within a particular post.
Hi @hammondjp11
If I understand your question correctly I think that the html2react
package and processors will do what you want.
The content author could, for example, put a <span>
element in the article with a particular class name. The processor would then have a test
property that matches the <span class="yourclassname">
, for instance, and replace it with a component.
See this page for a full description of how html2react
and processors work, and this repo for a practical example.
Hope this helps.