Hello.

I am trying to import data from a Backdrop site to another Backdrop site.

I've created an importer for vocabularies/taxonomies/terms with the Feeds module.

In the Taxonomy term processor Mapping , I have added

  • GUID
  • Term name
  • Parent:Term name (parent)
  • Path alias (path_alias)

When I actually imported them using the importer with a CSV file, the items I entered in the Path alias (e.g. tags/information, tags/information/event, etc.) were not imported at all.
How do I write the Path alias?

Thanks;

Accepted answer

Well, I was curious and tried to import some terms into a test site, and that worked quite well, even without the bulk action to generate URL aliases. I followed these steps:

  • Create an empty vocabulary, example: Favorite Colors
  • Configure a URL alias pattern for the vocabulary, e.g. color/[term:name]
  • Create a Feeds importer (File upload, CSV parser), mapping:
    • GUID => GUID
    • Term => Term name
    • Alias => Path alias
  • Create a CSV file. Example:
GUID,Term,Alias
0001,Blue,colors/blue
0002,Brown,colors/brown
0003,Green,colors/green
0004,Orange,colors/orange
0005,Purple,colors/purple
0006,Red,colors/red
0007,Yellow,colors/yellow
  • Import the CSV file.
  • Check the path of the imported terms, e.g. colors/orange

I think, it would even work without importing the aliases and also without bulk generating them.

Comments

Olafski's picture

I don't know how to import a Path alias but here's an idea for another approach:

  • Check the URL alias pattern for the vocabularies in question on the page URL Alias Patterns (admin/config/urls/path/patterns):
    • Depending on your needs, choose a  custom pattern, e.g. [colors]/[term:name], or leave the default  pattern [term:vocabulary]/[term:name].
  • Import your vocabularies without path aliases.
  • Go to the page URL Aliases Bulk Actions (admin/config/urls/path/bulk-update).
    • Scroll down to section Taxonomy term URL aliases, and select the imported vocabularies.
    • Scroll back to the top of the page, section Operations. Choose the action Generate URL aliases, and hit the Execute button.

      If this action doesn't work, you may also want to try the action Update existing URL aliases.
  • Go to your vocabulary page, e.g. admin/structure/taxonomy/tags, and check the terms for their aliases.

Let me know if the approach works for you.

Olafski's picture

Well, I was curious and tried to import some terms into a test site, and that worked quite well, even without the bulk action to generate URL aliases. I followed these steps:

  • Create an empty vocabulary, example: Favorite Colors
  • Configure a URL alias pattern for the vocabulary, e.g. color/[term:name]
  • Create a Feeds importer (File upload, CSV parser), mapping:
    • GUID => GUID
    • Term => Term name
    • Alias => Path alias
  • Create a CSV file. Example:
GUID,Term,Alias
0001,Blue,colors/blue
0002,Brown,colors/brown
0003,Green,colors/green
0004,Orange,colors/orange
0005,Purple,colors/purple
0006,Red,colors/red
0007,Yellow,colors/yellow
  • Import the CSV file.
  • Check the path of the imported terms, e.g. colors/orange

I think, it would even work without importing the aliases and also without bulk generating them.

Thank you as always Olafski.
Your first reply gave me the very solution for the terms I've already added, and it worked well!

I'm facing new issue, the [term:name] is automatically determined when I use Japanese character for the name of term. They looks very strange for us (e.g. "靴下(=sox)" turns into an unknown phrase "xuexia"), however it doesn't really matter now. I'm waiting for the future update for the function of setting machine names for terms.

And your second reply was what I exactly wanted, it works completely.
I really appreciate your help!