I’m just getting started with React and Frontity. I’m trying to build a theme but I need to be sure of how I should handle page building.
So far, I’ve come to the conclusion that the best way to build the pages that Frontity will get is with Gutenberg, however I can’t seem to find a lot of resources regarding this. So far, this topic (more specifically @luisherranz 's answer with the Gallery example and https://docs.frontity.org/api-reference-1/frontity-html2react have been my main sources of information, but I still have some questions.
For example, I’m trying to build a Component to handle the .wp-block-quote Gutenberg block. This block, specifically renders like this:
<blockquote class="wp-block-quote">
<p>No more of this</p>
<cite>Some guy said this</cite>
</blockquote>
@juanma Thanks!! I’m glad my question can help others! Maybe this https://docs.frontity.org/api-reference-1/frontity-html2react#create-your-own-processors should have another example? Because the Image Processor example doesn’t cover a lot of use cases, including those such as this one, where you want to pass the “processed” html into multiple different places inside the Component.
You are probably missing the CSS styling for this. I added the Gutenberg stylesheet locally to my project to make the default Gutenberg blocks work somewhat.
I think Frontity is working on something better but that is not available at the moment: Gutenberg Package
These processors are defined by a pattern that will be looked for the HTML and a React component that will be returned instead of every piece of HTML that matchesthe pattern
Nice video re. processors. Could you clarify one thing for me?
If I have the default style for a blockquote set via Global.
Then I want to apply styling overrides to the elements with a class, is there a way to perform more than one test on the element or do I need to create a separate processor file for each match?
test expects a function which will receive each component (each tag) with its props (its attributes).
This function returns a boolean value, so inside this function you can perform any operation and comparison as long as the function returns a boolean value that reflects the matching pattern you want for that processor
In a more verbose way, this processor could be defined as…
I think @shaun is trying to return different components depending on the className, which is a different situation from what you are describing @juanma