Skip to content

Pretty URLs break “Edit this page” links #888

@infotexture

Description

@infotexture

Expected Behavior

While reporting dita-ot/docs#607, @stefan-jung discovered:

I tried to modify the following topic with the Edit this page button:
https://www.dita-ot.org/dev/topics/plugin-messages#ariaid-title1

— but it didn't work.

Actual Behavior

oXygen XML Web Author returns an error that it can't find the resource to edit.

Looks like a side-effect of Netlify’s post-processing for pretty URLs.

At first glance, it looked like the trailing fragment identifier #ariaid-title1 that Algolia adds when you follow links in the site search results could be to blame.

But stripping that isn’t enough. Web Author also doesn’t find the topic under topics/plugin-messages.

It seems Web Author relies on the .html file name extension to locate the corresponding .dita source file.

If you manually edit the URL in your browser to topics/plugin-messages.html and then click Edit this page, it works.

Possible Solution

We’d probably need to edit the logic in the parse() function on lines 55–56 of the EditController.js file.

Not sure if there's a concise (and resilient) way of refactoring that that would work with the pretty URL syntax. 🤔

One thing that comes to mind would be walking the URL backward from the end to find the last slash /, then using the final sequence of letters, dashes, or underscores that construct the root filename, ignoring any trailing fragment identifiers.

— but there may be a better way.

@raducoravu, @jelovirt Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions