skybrud / Skybrud.Umbraco.Redirects.Import

Import and export addon for Skybrud.Umbraco.Redirects.
MIT License
7 stars 11 forks source link

Import format #10

Closed danbramall closed 1 year ago

danbramall commented 1 year ago

Hi, I maybe missing something obvious but I can't seem to find any reference to the requirements for formatting data for import. i.e. Does it rely on certain columns / column headings being in place to upload correctly? I'm trying an XLSX file with no headings and two columns (column 1 is the old URL, column 2 is the new URL) but am getting errors. Many thanks!

danbramall commented 1 year ago

Having checked out the source, it looks like the imported file should have the following headers:

RootNode,InboundUrl,InboundQuery,DestinationId,DestinationKey,DestinationType,DestinationUrl,DestinationQuery,DestinationFragment,RedirectType,ForwardQueryString

I left all but 'InboundUrl' and 'DestinationUrl' blank and set 'RedirectType' to 'url'and that seems to have worked okay.

Thanks very much for putting this together by the way - it's especially useful now that .NET Core makes it more difficult to create redirects than it used to be back in the 'web.config all the things!' days! :)

abjerner commented 1 year ago

@danbramall unfortunately I haven't gotten around to writing any documentation yet, but good to hear that you found a solution 👍

The import logic supports different column names. So for the the old URL, you can use either of the following names:

Column names are case-insensitive, and spaces are ignored. So for instance originalurl would also be accepted.

For the destination URL, there following column names are supported:

The other columns are optional. Eg. the Type column may be used to specify whether a redirect should be Permanent or Temporary.