You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DOCUMENTATION.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
## Installation
2
2
3
+
> **Note:**
4
+
> Before installing the importer addon, please ensure your project has a database configured. The importer uses a database to keep track of import progress. If you created your site using the [Statamic CLI](https://github.com/statamic/cli), a SQLite database will have been setup for you. You can confirm by running `php artisan migrate`.
5
+
3
6
1. You can install the Importer addon via Composer:
4
7
5
8
```bash
@@ -17,6 +20,7 @@ Before importing, you will need to do some preparation:
17
20
* Ensure you have either a CSV or XML file to import.
18
21
* You will need to produce separate files for each type of content you wish to import. For example: one file for Page entries, one for Blog entries, another for Users, etc.
19
22
* When you're uploading a CSV, the CSV needs to have a header row.
23
+
* Some fields allow importing multiple values. In this case, values should be separated by a pipe (`|`).
20
24
* When you're coming from WordPress, please see the [WordPress](#wordpress) section below.
21
25
* Create the necessary collections and taxonomies in Statamic.
22
26
* Configure the necessary blueprints for those collections and taxonomies.
@@ -29,13 +33,14 @@ Before importing, you will need to do some preparation:
29
33
3. You can then map fields from your blueprint to fields/columns in your file.
30
34
* Depending on the fieldtype, some fields may have additional options, like "Related Key" or "Create when missing". You can read more about these below.
31
35
* Mapping is disabled for some fieldtypes, like the [Replicator fieldtype](https://statamic.dev/fieldtypes/replicator#content). If you wish to import these fields, you will need to build a [custom transformer](#transformers).
32
-
4. You will also need to specify a "Unique Field". This field will be used to determine if an item already exists in Statamic.
36
+
* When you're importing taxonomy terms into a non-default site (eg. not the _first_ site you created) and the slugs differ between sites, you can map the "Slug in Default Site" field to the slug of the term in the default site in order for the importer to match up the terms correctly.
37
+
4. If you're importing entries, you will also need to specify a "Unique Field". This field will be used to determine if an entry already exists in Statamic.
33
38
5. Then, run the import and watch the magic happen! ✨
34
39
35
40
You can run the importer as many times as you like as you tweak the mappings. It'll update existing content and create new content as needed.
36
41
37
42
#### Queueing
38
-
If you're importing a lot of content, you may want to consider running a queue worker to handle the import in the background.
43
+
If you're importing a lot of content or downloading a lot of assets, you may want to consider running a queue worker to handle the import in the background.
39
44
40
45
Assuming you have Redis installed, you can update the `QUEUE_CONNECTION` in your `.env` file to `redis` and then run:
41
46
@@ -56,8 +61,12 @@ When you're configuring mappings for an Assets field, or a Bard field, a few add
56
61
***Download when missing?**
57
62
* By default, when the importer comes across an asset it can't find in Statamic, it will skip it.
58
63
* However, if you wish, the importer can download any missing assets for you into the configured asset container.
64
+
***Process downloaded images?**
65
+
* Determine whether downloaded images should be processed using the asset container's [source preset](https://statamic.dev/image-manipulation#process-source-images).
59
66
***Folder**
60
67
* By default, downloaded assets will use same folder structure as the original URL. If you'd like to download them into a specific folder, you can select one here.
68
+
***Alt Text**
69
+
* Determine which field in the row contains the alt text for the asset. This option will only be shown when the Asset blueprint has an `alt` field.
61
70
62
71
When importing a Bard field, assets will only be imported when the "Container" config option has been set in the blueprint.
63
72
@@ -80,6 +89,9 @@ While you *can* use WordPress' built-in export tool, it doesn't contain all the
80
89
81
90
Instead, we recommend using a plugin like [WP All Export](https://wordpress.org/plugins/wp-all-export/) to export your content. It allows you to customize the columns included in the export (like ACF fields, featured images, etc.) and it'll give you a CSV.
82
91
92
+
### Classic Editor
93
+
If you're importing content from the Classic Editor into a [Bard field](https://statamic.dev/fieldtypes/bard#overview), you will likely want to enable the "WordPress: Replace double line-breaks with <p> tags" option, which will wrap any unwrapped text in `<p>` tags before importing it into Bard.
94
+
83
95
### Gutenberg
84
96
Statamic's [Bard fieldtype](https://statamic.dev/fieldtypes/bard#overview) is the closest equivalent to WordPress' Gutenberg editor.
You can find the Importer addon in the Control Panel under `Utilities > Importer`.
21
21
22
+
> **Note:**
23
+
> Before installing the importer addon, please ensure your project has a database configured. The importer uses a database to keep track of import progress. If you created your site using the [Statamic CLI](https://github.com/statamic/cli), a SQLite database will have been setup for you. You can confirm by running `php artisan migrate`.
Copy file name to clipboardExpand all lines: lang/en/messages.php
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,26 @@
5
5
'utility_description' => 'Import entries, taxonomies, and users from XML and CSV files.',
6
6
7
7
'configuration_instructions' => 'You can add or modify your Blueprint fields to customize what data is imported and what fieldtype it will be stored in. You can save, refresh, and come back to this import config later until it\'s ready to run.',
8
+
'destination_blueprint_instructions' => 'Select which blueprint should be used for imported content.',
8
9
'destination_collection_instructions' => 'Select the collection to import entries into.',
9
10
'destination_site_instructions' => 'Which site should the entries be imported into?',
10
11
'destination_taxonomy_instructions' => 'Select the taxonomy to import terms into.',
11
12
'destination_type_instructions' => 'Choose what type of data are you importing.',
12
-
'import_file_instructions' => 'Upload a CSV or XML file to import. This will replace the current file.',
13
-
'import_file_instructions_create' => 'Upload a CSV or XML file to import.',
13
+
'import_file_instructions' => 'Upload a CSV or XML file to import.',
14
14
'import_name_instructions' => 'Name this import so you can identify it later.',
15
15
'mapping_instructions' => 'Map the fields from your import to the fields in your blueprint.',
16
16
'strategy_instructions' => 'Choose what should happen when importing.',
17
17
'unique_field_instructions' => 'Select a "unique field" to determine if an item already exists.',
18
18
19
+
'assets_alt_instructions' => 'Which field should be used for the alt text?',
19
20
'assets_base_url_instructions' => 'The base URL to prepend to the path.',
20
21
'assets_download_when_missing_instructions' => 'If the asset can\'t be found in the asset container, should it be downloaded?',
21
22
'assets_folder_instructions' => 'By default, downloaded assets will use same folder structure as the original URL. You can specify a different folder here.',
22
23
'assets_related_field_instructions' => 'Which field does the data reference?',
24
+
'assets_process_downloaded_images_instructions' => 'Should downloaded images be processed using the asset container\'s source preset?',
25
+
'bard_wp_auto_p_instructions' => "You may want to enable this if you're importing from the Classic Editor.",
26
+
'date_start_date_instructions' => 'Which field should be used for the start date?',
27
+
'date_end_date_instructions' => 'Which field should be used for the end date?',
23
28
'entries_create_when_missing_instructions' => 'Create the entry if it doesn\'t exist.',
24
29
'entries_related_field_instructions' => 'Which field does the data reference?',
25
30
'terms_create_when_missing_instructions' => 'Create the term if it doesn\'t exist.',
0 commit comments