⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@madebyisaacr
Copy link
Collaborator

@madebyisaacr madebyisaacr commented Jan 13, 2026

Description

This pull request updates the CSV import plugin to allow using fields that are ignored/disabled as the slug field. This fixes an issue where if your CSV has a slug column, it would create duplicate fields because it would import as both the slug value and as a separate field.

I also made it check if there's a column that matches the slug field name, and if so it will be selected by default and the row will be ignored by default to avoid creating a duplicate slug field.

Testing

Google Sheet for testing: https://docs.google.com/spreadsheets/d/1JuOKh_Wb0uIytKe4eE7uI6Js826i8V_uf2oFtyolDtA/edit?gid=1174080602#gid=1174080602

  • Check if the "Slug" column is the default selected slug field even though it is not the first column.
  • Disable the "Slug" column and check if it still allows you to use it as the slug field.

const possibleSlugFields = calculatePossibleSlugFields(initialMappings, csvRecords)
setSelectedSlugFieldName(possibleSlugFields[0]?.columnName ?? null)
const slugField = collection.slugFieldName
? (possibleSlugFields.find(field => field.columnName === collection.slugFieldName) ??
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we match an existing slug mapped on its own column, won't that result in us ignoring the slug values for new rows? I need to test this out

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. Slug values are never ignored - you get an error in additems() if a row has no slug.

@Nick-Lucas Nick-Lucas self-requested a review January 14, 2026 17:10
action: "map",
targetFieldId: matchingField.id,
hasTypeMismatch,
action: isSlugField ? "ignore" : "map",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I just tried an import on a new collection and it didn't auto-ignore the slug column, maybe the change I proposed needs a bugfix

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was the slug column's name the same as the slug field name on the collection, usually "Slug"? It only auto ignores it if the slug column name matches, because we don't want to ignore it by default if it's using a different column for the slug like "Title" for example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you copy and paste this table in with the Slug column, it should make the Slug field ignored by default. But if you copy without the first column then it should make Title the slug field and not make Title ignored.

https://docs.google.com/spreadsheets/d/1JuOKh_Wb0uIytKe4eE7uI6Js826i8V_uf2oFtyolDtA/edit?gid=1174080602#gid=1174080602

Copy link
Contributor

@Nick-Lucas Nick-Lucas Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good point.

Image

So I think this might be confusing to be honest, not sure most users will understand why that column is disabled. And also if we're only covering the scenario where the slug name is the same as a column name, then displaying the mapping isn't a bad thing or incorrect right?

Maybe we should bring @johannes-ger in on the discussion?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants