Contentful Link Cleaner
This tool cleans up unresolved Entry links in Contentful spaces.
When you have a link to an Entry or Asset on a Published Entry, if you delete the linked Entry the Entry that links to it will have a reference to a non existing entity.
This tool goes through all of your entries, figures out which links don't exist anymore, and removes them.
This might be particularly relevant to users of contentful-space-sync.
If you're not entirely clear on what Links are, check out the Links page for more information.
This tool will ask you if the entries which have had their links fixed should also be published. This is the default, and we recommend that we do.
Any entries that don't get their links fixed will stay in "updated" state and will need to be published manually.
Check out the releases page.
npm install -g contentful-link-cleaner
Usage: contentful-link-cleaner [options] Options: --version Show version number --space ID of Space with source data [string] [required] --delivery-token Delivery API token [string] [required] --management-token Management API token [string] --pre-publish-delay Delay in milliseconds to account for delay after creating entities, due to internal database indexing [default: 5000] --config Configuration file with required values
example-config.json file for an example of what a configuration file would look like. If you use the config file, you don't need to specify the other options for tokens and space ids.
contentful-link-cleaner \ --space sourceSpaceId \ --delivery-token spaceDeliveryToken \ --management-token spaceManagementToken
contentful-link-cleaner --config example-config.json
You can create your own config file based on the