Migrate from Paragraphs Proof of Concept

Created on 18 September 2018, over 6 years ago
Updated 31 March 2023, over 1 year ago

While there is interest in building a Paragraphs compatible solution, there is also interest in porting existing paragraphs pages to Gutenberg. This is a major undertaking. To know if it is even possible, we should do an absolute minimalistic POC:

- Create a very simple Paragraphs type with a field for Text or Title
- Review what the corresponding Gutenberg core block would be
- Suggest what mechanisms would be needed to recreate the Paragraph content into a fully working Gutenberg block instance

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇳🇴Norway perandre

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands Ronald van Belzen

    I build such a tool for my employer to help a customer in the transition of existing content to Gutenberg. The existing content contained nested paragraphs. I do not think I am allowed to share the code, but I can make a suggestion for a possible approach.

    My approach was creating templates for converting content of content types and paragraph types. The templates contained tokens for referring to content values and entity references and their field values, or media items.
    Special fields in the tokens referred to special functions in the engine that was able to convert those templates by replacing the tokens and concatenated them, resulting in a list of Gutenberg blocks that were saved in the body of the to be converted node.
    The templates were in fact in most cases already Gutenberg blocks with tokens representing the dynamic content.

    Templates were saved in configuration, and configuration was also used to indicate which content type(s) needed to undergo transition.

    Furthermore, I patched the Gutenberg module function _gutenberg_is_gutenberg_enabled() and added an extra check for whether an individual item (and even individual translation of that content item) of the content_type (for which the Gutenberg experience was switched on and was placed in transition) was already converted (which needed to be tracked in a db table).

    This had the added advantage that an editor could convert the content one item and translation at a time, and maybe not convert all the old content and still add new content using the Gutenberg experience at the same time.

    During the conversion there needs to be a display for the old content and one for the converted (or new) content, and a switch between the two displays depending on whether the node had been converted of not.

    Preparing for transition with such a tool still includes alot of work, but it makes the actual converting of content possible.

Production build 0.71.5 2024