Two interconnected issues here:
First, if you import content to a content type with an autopath pattern set, the created nodes do not get the auto generated URL. E.g., they have node/###.
This seems to be because there is no 'path' entry in the values used to create the new entity. This means a test is the path field exists done by the pathauto entity hooks fails. A value is needed here to trigger the pathauto autogenerate process.
Second, item is that the path target (URL Alias) is not available when defining a map for a content type with a pathauto pattern set.
Traced this down to the path field being marked as Read Only by pathauth. It seems like the path target code should override the FieldTargetBase::targets method to allow this to be available. This would allow non-autogenerated paths to be imported.
I'm not sure the best way to approach this problem, so I don't have a patch for this.
Comment | File | Size | Author |
---|---|---|---|
#8 | basic page node import mappings.jpg | 86.12 KB | elsteff1385 |
#7 | feeds-path-target-2948484-7.patch | 1.51 KB | MegaChriz |
|
Comments
Comment #2
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedNot for all fields mapping targets are implemented. For path alias there should be a mapping target available. This would be a feature request.
As for Pathauto, when not mapping to the path alias, I expect Pathauto to automatically set an alias when a pattern is configured for the content type in question. If it doesn't, then it sounds like a bug in Pathauto.
Changing this into a feature request for the path alias target.
Comment #3
cgmonroe CreditAttribution: cgmonroe as a volunteer commentedGood call on part #1, being a pathauto bug. There is now a patch for pathauto that lets imported nodes be created with the autogenerated alias.
See: #2946273: Alias is not generated when Pathauto widget is hidden
And you're right, having the path available for pathauto related nodes is a feature.
Comment #4
kollod CreditAttribution: kollod as a volunteer commentedThis is a key feature for those who`d like to upgrade from D6 to D8. The core Upgrade (so called "experimental modules") feature is non-working. Feeds do the job greatly except but importing aliases. Consider this please when will work on next version...
Anyway, I`ve found a solution how to import aliases into D8 ( this from here - LOL! I tried many ways and searched for modules... but simple solution was there)I`ve imported my D6 aliases with Feeds mapping them to custom link_type field ("field_mycustomurltupefield") in Drupal8, and then Bulk generated (Pathauto) new aliases for nodes using token [node:field_mycustomurltupefield:uri]. You only have to set Pathauto to not strip some letters ("/", ".", "-" etc.) and strip "internal" (added to link type field if path is not absolute).
I`ll share the metod in another topic...
p.s. I also tried to autocopy imported aliases from custom field`s "value" row in Mysql tables into "url_aliase" table, but aliase table has different structure - aliases are assigned to nodes "/node/904", unlike field`s data - to "entity_id" with numbers that are equal to node`s ID numbers (there still should be a way to do this via Mysql...)
UPD. The above method didn`t work in fact - Feeds not transferring aliase data into link type fields, although it does allow to map them (Pathauto does Bulk generates aliases from link type fields, but I`ve put those aliases manually into 2-3 three fields just to check as if... then Feeds didn`t do the job. So I was to quick in my conclusions).
So the only way I found is to hack core Path module. From my post Upgrade D6 to D8 with Feeds. We can
Aliases are all there. There will be be some unexpected things if you try to delete "field_kool_hack_path" field later. It happaned to me, but I`mworking with backups (at each stage downloading backup). Better don`t do this. It would be easier way to update/clone D8->D8 to get rif of that field etc..
Comment #5
frankx CreditAttribution: frankx commented13.02.2019
With Module Feeds import csv file from a content type into a conten type on D869 webseite. It worked well.
Just, I could not change the imported node id or number (node/xxx) with a new URL-Alias.
I tried to give a node, which i created within the same content type of the D8 webseite directly, a new URL-Alias and it worked as usual.
BUT i can not give the URL-Alias to the imported nodes.
is a way to solve the problem?
Thank a lot for your help.
i found out:
Administration-> Configuration-> Search and metadata
+Add redirect
Add path manuelly
Comment #6
elsteff1385 CreditAttribution: elsteff1385 as a volunteer commented#4's hack is not working (anymore).
Subbing to this topic, in the latest Feeds 8.x-dev the "URL Alias" or "Path Alias" is not available (from the target dropdown menu) in mapping of a Feed.
I have disabled/deleted all Pathauto patterns.
Drupal 8.6.13
Feeds 8.x-3.0-alpha4+10-dev
Pathauto 8.x-1.3
Comment #7
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedI think that the Pathauto module somehow marks the path field read-only. Feeds assumes you cannot import values for read-only fields, so doesn't provide a field target in this case.
Here's a hack to let Feeds skip the read-only check for the path field. Not tested if this works or what the implications are, but the field does show up as target.
Comment #8
elsteff1385 CreditAttribution: elsteff1385 as a volunteer commented#7 confirmed working.
1: /admin/config/search/path/patterns -> in the related pattern, i disabled the specific content type (in my case "Basic Page")
2: /admin/structure/feeds/add -> added feed type. settings:
- Fetcher: upload file
- Parser: CSV
- Processor: Node
- Content type: Basic Page
- Import period: Off
- Parser settings: default delimiter: ;
- Processor settings: Update existing contents
3: /admin/structure/feeds/manage/basic_page_node_import/mapping
- screenshot attached
4: /feed/add -> uploaded CSV file.
- This failed with error message: "Alias path alias/1 has to start with a slash." -> nice specific error info.
5: /feed/add -> uploaded fixed CSV file.
No errors, perfect result :)
Comment #10
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedThe hack will do for now. Committed #7 (with coding standard fixes).