Pros & Cons when converting HTML β†’ JSON Rich Text for a blog detail page

  • carterux-1354065057604046958

    Seun Orofin

    7 days ago

    I am working on a blog detail page and currently the content is coming from the API as HTML...i am thinking of converting the HTML into a structured JSON so i can render using structured content.

    To give more context
    i literally want to go from:

    <p>This is some text</p>
    <h2>Heading</h2>
    <blockquote><p>Quoted text</p></blockquote>


    to:

    {
    "nodeType": "document",
    "content": [
    {
    "nodeType": "paragraph",
    "content": [
    {
    "nodeType": "text",
    "value": "This is some text",
    "marks": [],
    "data": {}
    }
    ],
    "data": {}
    },
    {
    "nodeType": "heading-2",
    "content": [
    {
    "nodeType": "text",
    "value": "Heading",
    "marks": [],
    "data": {}
    }
    ],
    "data": {}
    }
    ]
    }
  • Tod-1354065059709718559

    Tod

    7 days ago

    Great energy @Seun Orofin! Your continuous contribution to the toddle Community just made you advance to Community Level 9!
  • carterux-1354065279235133471

    Seun Orofin

    7 days ago

    How does this affect SEO? & is this a reasonable option?
  • whitep4nth3r-1354065776637644871

    salma

    7 days ago

    The only thing that will affect SEO is the resulting HTML structure of your page. Converting WYSIWYG HTML to JSON is a great approach for making sure you have flexibility is presenting the information on the page. CMSs like Contentful provide this type of API response for rich text content for these reasons.
  • Definitely a reasonable option!
  • whitep4nth3r-1354066076706803763

    salma

    7 days ago

    Just make sure that the structured content on the page matches the specification. You can test your structured content output using https://developers.google.com/search/docs/appearance/structured-data
  • (I assume you mean the structured content usually presented in script tags as JSON format for things like google rich results)
  • carterux-1354068708464791575

    Seun Orofin

    7 days ago

    Basically i am trying to see the possibility of using the Toddle way of handling blog detail page rendering from this :

    https://toddle.dev/projects/toddle_blog_template/branches/main/components/Blog%20Article?rightpanel=attributes&canvas-width=1236.8&canvas-height=1779.3

    The only thing is that my content is not coming from Contentful..it is coming from Xano as HTML...

    Reason why i asked if it makes sense to first convert the HTML into a contentful like structure then render the elements
  • whitep4nth3r-1354071039352504395

    salma

    7 days ago

    From my experience in dealing with HTML vs JSON structured data coming from an API, it makes sense
    πŸ™1
    ❀️1

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.