在 Discourse 中导入时保留旧帖子 ID

The import script saves the import id in a post custom field. You can use it to create permalinks. Several importers do that. You can look at others for examples.