friends-of-hugo/contentful-export

Translate filenames for readability

Opened this issue · 0 comments

Currently, filenames are based on Content ID. Hugo can work with that. But it is not helpful for human readability. Especially for users who consider moving away from Contentful at some point.

Translating to readable names can be tricky for sites with more items than fit on a single page (>1000 items). An item may refer to another item that has not yet been loaded and therefore is more expensive to resolve.

Possible strategies:

  • Request items not in current page
    • Slow and lots of network traffic
  • Load all items in memory before processing
    • Memory-intensive
  • Keep list of items that have unresolved references and resolve them when a new page comes
    • Probably less memory intensive but depends on specific use cases. Also complex
  • Two-pass strategy first writing all items to a work-dir as a half-fabricate while building up an ID-name translation table. Then in the second pass, rename all items and references in the content.
    • Probably the most reasonable tradeoff between speed and memory use. Some impact due to increased disk use and need to ensure clean-up of the work-dir. (PREFERRED)