Skip to main content

How to import and export landing pages

This guide explains how to create and update many landing pages at once from a CSV file, and how to export existing landing pages for backup, bulk editing, or migration to another store.
Import and export use the same CSV format, so you can export your pages, edit the file in a spreadsheet, and import it back.

1. Export landing pages​

You can export landing pages from the admin panel or from the command line.

From the admin panel: navigate to Content -> Landing Pages, select the pages to export, and choose Actions -> Export to CSV. The browser downloads the landing_pages.csv file.

From the command line: run the following command from the Magento root directory to export all landing pages to a file:

bin/magento mirasvit:landing-page:export var/landing_pages.csv

Each page is exported as one base row. Every store view where the page has its own values gets an additional row.

2. Prepare the CSV file​

Edit the exported file, or start from the sample: on the import screen, click Download Sample CSV. The file must contain the page_url_key or the url_key column to identify the pages. You can omit any other column.

ColumnDescription
page_url_keyWhich landing page the row applies to — the page's current URL key. If no page has this URL key, a new page is created. If the column is missing or blank, the page is identified by url_key.
store_codeLeave blank for the base row with the page's default values. Enter a store view code (e.g., default) to set values for that store view only.
storesStore views where the page is displayed: comma-separated store view codes, or all. Used in the base row only.
nameName of the page.
url_keyURL key of the page. To rename a page, keep the current value in page_url_key and put the new one here.
is_activeEnables (1) or disables (0) the page.
redirectEnables (1) or disables (0) the redirect to the landing page.
page_titlePage title.
meta_titleMeta title.
meta_tagsRobots meta tags, e.g., INDEX, FOLLOW.
meta_descriptionMeta description.
descriptionDescription of the page (HTML is allowed).
search_termSearch term that narrows the product listing.
categoriesComma-separated category IDs, e.g., 12,13. Used in the base row only.
imageFile name of an image that is already uploaded to the pub/media/landing folder, e.g., summer-sale.jpg. Used in the base row only.
filtersFilters of the page: attribute codes with option labels (or option IDs). Options are separated by |, attributes by &, e.g., color=Red|Blue&size=M. Use none to remove all filters from the page. Used in the base row only.

Yes/no columns also accept yes/no and true/false.

note

A blank cell does not erase anything. In a base row, a blank cell keeps the current value of the page. In a store view row, a blank cell means the store view uses the default value from the base row.

A new page is created enabled and without a redirect unless the is_active and redirect columns say otherwise. If the name column is blank, the URL key is used as the page name.

A store view row applies only to an existing page or to a page whose base row is placed above it in the same file. Otherwise, the row is skipped.

The Top CMS block, Bottom CMS block, and Layout update XML settings are not part of the CSV. Set them on the landing page edit form.

3. Import the file​

From the admin panel: navigate to Content -> Landing Pages and click Import from CSV. Select the file in the CSV File field and click Import.

From the command line: run the following command, which is convenient for large files:

bin/magento mirasvit:landing-page:import var/landing_pages.csv

The import reports how many pages were created, updated, unchanged, and skipped. A row with an error (for example, an unknown store view code, attribute, or option) is skipped and reported with its row number, while the other rows are still imported. The import never deletes landing pages.

tip

To check a file before importing it, select the Dry run checkbox on the import screen, or add the --dry-run option to the command. The import then validates the file and reports the counts without saving any changes.

After the import, clear the Magento cache to apply changes.


Copy landing pages to another store view​

Use import and export to translate landing pages for another language store view:

  1. Export the landing pages.
  2. In the CSV file, copy the base row of each page and set store_code to the code of the target store view (e.g., fr).
  3. In the copied rows, enter the translated values: name, page_title, meta_title, meta_description, description, and, if needed, a different url_key. Clear the cells that should stay the same as in the base row.
  4. Make sure the target store view is listed in the stores column of the base row, or that the column contains all.
  5. Import the file.

Example:

page_url_key,store_code,stores,name,page_title
summer-sale,,all,Summer Sale,Summer Sale
summer-sale,fr,,Soldes d'été,Soldes d'été

For descriptions of all landing page settings, see the landing pages document.