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.

This file should not be imported in this context error

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.

Divi JSON context

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!

 

Pin It on Pinterest

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close