Relative path links from notes accessible both from local server as deployed server.
See original GitHub issueWhat problem would this feature solve?
Possibility to access components via the same relative path (with extension) between the local development server and the build variant being hosted elsewhere.
Right now, if you put a relative URL in the notes pointing to another component, for instance: ./component-name
, it will work fine on the local development server. The default settings on the builder make it work so it contains the extension (.html). Therefore when you host the build variant elsewhere, your notes with the ./component-name
the link will result in a 404.
Vice versa this has the same effect, so if we would construct the link to contain the extension, as such: ./component-name.html
, this will work fine in the build variant. But this won’t work in the local development server as it will try and match the handle including the extension (stating: Not found - Component ‘component-name.html’) not found.
It would be a bit more decent, functionality-wise, if these inner links don’t break depending on the environment its on.
What the feature should look like?
A possible solution is to overwrite the default extension the builder script receives from the config, and change the htaccess file to point towards the extension-less build files, this is already implemented. But, as is the case in my current environment, I don’t have the opportunity to go and modify that. Therefore, why not have the possibility to inverse this mechanism from the local environment as well?
From the config, it could supply an extension (by default ‘.html’) which then gets retrieved in the local server and somehow knows how to match the appropriate component. That way he will strip off the extension and can match the handle accordingly.
Proposed solution (direction): #659 - see discussion below on cleanliness
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top GitHub Comments
That should be a bug in the path helper in the handlebars adapter, since it should do an early return for server - see here. I’m pretty sure this worked when I fixed the related bug though, not sure what has changed since then.
Either way, using the path helper should be the correct way, and this bug in the path helper should rather be fixed than worked around via a new option.
Yeah I’d like to understand the issue better so I could maybe suggest a better fix. I can wait for the repro for a bit 😃