Have you ever seen the red error message that says “file should not be imported in this context” when trying to import a Divi layout or template JSON file to Divi?
The reason this error message shows is that there are different types of layout and template files for Divi. They all use the .JSON file extensions, but each must be imported in the correct area depending on where it was originally exported.
There are 3 types of JSON files for layouts and templates in Divi
With the introduction of the Theme Builder in Divi 4.0, we now have 3 types of JSON files that each need to be used in the correct place. There are 2 types of JSON for Divi layouts and 1 for Divi Theme Builder templates. You can create JSON files by;
- Exporting a Divi layout from the Divi library
- Exporting a Divi layout from a page or post
- Exporting a Divi template from the Divi Theme Builder
The trial-and-error method of fixing the error message
If you have tried to import a JSON file into the wrong place and get the error message, there are only 2 other places to try, so trial-and-error is usually my next step.
- If you see “file should not be imported in this context” while importing a JSON file into an individual page, it means you should either be importing it into the Divi Library or the Divi Theme Builder.
- If you see “file should not be imported in this context” while importing a JSON file into the Divi Library, it means you should either be importing it into an individual page or the Divi Theme Builder.
- If you see “file should not be imported in this context” while importing a JSON file into the Divi Theme Builder, it means you should either be importing it into the Divi Library or an individual page.
How to see where a JSON file was exported from?
All Divi layout and template files use JSON files, so unless they are named in a way to help identify what type of layout or template data is included in the files, then, you will need to open up the file and take a look at the code.
By opening the JSON file in a browser or text document you will see code at the start of the file that will tell you which type of layout or template file it is. With this info, you will then know where you should be importing the file.
Each JSON file will have one of the following code at the start of the file;
- “context”:”et_builder”,”data”: Which means that the file was exported from a page or postÂ
- “context”:”et_builder_layouts”,”data”: Which means that the file was exported from the Divi Library
- “context”:”et_theme_builder”,”templates”: Which means the file was exported from the Divi Theme Builder
Where can I import each type of JSON file?
- “context”:”et_builder”,”data”: = Exported from page or post = Can be imported into a page or post
- “context”:”et_builder_layouts”,”data”: = Exported from Divi library = Can be imported into the Divi Library
- “context”:”et_theme_builder”,”templates”: = Exported from Divi Theme Builder = Can be imported into the Divi Theme Builder
A better way to name your JSON files for Divi
Naming your layouts and Theme Builder templates with a standardized naming system on export would help identify what JSON file should go where.
So, you could start to name your JSON files with something that will help identify what the file is and where it came from so that you know where it is meant to be used. Something like;
- Every layout exported from the Divi library should be assigned DL-filename.JSON filename when exported.
- Every layout exported using from a page or post should be assigned DP-filename.JSON filename when exported.
- Every Theme Builder template exported from the Theme Builder should be assigned TB-filename.JSON filename when exported.
Final Thoughts
The ability to export and import Divi layouts and templates is one of the key features of Divi, but knowing exactly where a JSON file should be imported can get confusing.
It would be great if the error message “This file should not be imported in this context” could be replaced with “This file should not be imported in this context – it should be imported into … “, but until then, try and name your files clearly or just use trial-and-error like I usually do when I get the error message!
I wonder why Elegant Themes can’t just add to the error message to say exactly where a JSON CAN be imported. if the information is there in the file then it must be an easy addition?
don’t we all… 🙂
Thanks for this good information. I got that error message just this morning. 🙂
Thanks so much for this. It’s seldom that I google for specific information and find such a well-written, orderly, accurate article! Much appreciated.
glad it helped 🙂
There seems to be a fourth category (or, the nomenclature has changed). Here is what I am working with right now:
“context”:”epanel”,”data”:
Where should that one be imported into?
Thank you for the help, but for the ones that still can not fix the issue keep in mind that in the case of you page export (“context”:”et_builder”,”data”:) you are to import your jason file under the “Portability section” or the two arrows facing up and down that is right between the “Save to Library” and “Editing History” buttons in the purple Divi Builder Line. Hope this is helpful to the confused ones like me, hehe. 🙂
The issue did not go away…. show some video demo how to overcome this frustrating error. I did get a .json file from another website (scrap) and tried to import in one of the pages (used divi) and badly failed.