sphinx-contrib / confluencebuilder

Confluence Markup Builder Plugin for Sphinx
BSD 2-Clause "Simplified" License
314 stars 99 forks source link

Best practices for page title changes? #973

Open neongreen-sc opened 3 months ago

neongreen-sc commented 3 months ago

Right now, when page title changes, confluencebuilder removes the old page entirely & creates a new page -- even if the content hasn't changed.

It seems like Confluence Server doesn't handle this situation well -- links to the old page start saying "This page has been deleted". Usually for a broken link Confluence says "maybe you meant X", but not in this case.

Are there any best practices for mitigating this? The following ideas come to mind:

neongreen-sc commented 3 months ago

Nevermind this idea, I checked and even after purging all deleted pages it still doesn't show the "maybe you meant" box.

jdknight commented 3 months ago

There is no graceful solution at this time. Only the parent page option (if used) accepts an explicit identifier, and there is non-trivial way exposed to users to override page identifiers for other pages.

We could try to expose a hook for users to override the target identifier for a page. Would require some effort to ensure actions like dry-runs operate/report expected values with overrides -- assume if such an override could help. On this note (and related to the first suggestion made), we could try to add a page-id hint in confluence_metadata. Not sure about having this extension edit user's documentation -- maybe provide a output for users of published pages and which page IDs were used.

Hesitant on supporting caching for tracking identifiers. If this extension did any caching, it would be typically be stored locally in an output directory and not something that may live between different environments (e.g. container builds) or runs (if users force to clear cache).

The closest thing may be the use of confluence_title_overrides -- but this is an old option that was mainly designed for overriding specific documents with fixed names to a different name compatible with Confluence.

One approach that could be done is maybe this extension can provide a transform allowing a user to manipulate the entire title value based on the file document name and determined title value. Then users would be free to do any custom mappings they desire (e.g. use the file's document name as a title and set confluence_remove_title = False).