Skip to content
This repository has been archived by the owner on Feb 28, 2022. It is now read-only.

Clarify request url, path and introduce root #170

Closed
tripodsan opened this issue Jan 31, 2019 · 4 comments
Closed

Clarify request url, path and introduce root #170

tripodsan opened this issue Jan 31, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@tripodsan
Copy link
Contributor

tripodsan commented Jan 31, 2019

When a strain is selected with a URL condition, it is expected that the content repository is mounted below the url path. for example:

strain:
  url: https://www.project-helix.io/docs/api
  content: https://github.com/adobe/helix-docs.git#master/documentation.

should map a request of https://www.project-helix.io/docs/api/general/index.html?a=1 to
https://github.com/adobe/helix-docs.git#master/documentation/general/index.md.

the context.request object should have:

property value comment
url /docs/api/general/index.html?a=1 the original client request url
path /general/index.md the resource path
root /docs/api new: The mount root

Suggest

It might be confusing to have request.path different from request.url. so I suggest to introduce resourcePath, and keep the path the original client path.

property value comment
url /docs/api/general/index.html?a=1 the original client request url
path /docs/api/general/index.html the original request path
resourcePath2 /general/index.md the resource path
root /docs/api The mount root

2 Alternative: contentPath

/cc @trieloff, @kptdobe @stevengill

@tripodsan tripodsan added enhancement New feature or request question Further information is requested labels Jan 31, 2019
@tripodsan tripodsan self-assigned this Jan 31, 2019
@stevengill
Copy link

Hey @tripodsan

I'd say this is a good enhancement. Currently, I have no way to get the mount root in my pre.js file for my dispatcher.

@stevengill
Copy link

Four places I currently need the mount points:

  1. the dispatcher
  2. Before loading summary.htl, we need to figure out the location of summary.md. Need to add the mount point in there
  3. The side nav in the docs (where we convert the links to absolute links
  4. Any image tags in the content markdown repo. They link locally to images in the assets directory locally in their own repos. These links need to be rewritten with mount points.

@trieloff
Copy link
Contributor

+1

@tripodsan
Copy link
Contributor Author

tripodsan commented Feb 13, 2019

since the resource path is already available in the action.request.params, we should probably just add the rootPath there as well, and ensure that the context.request.path is the normal request path:

property value comment
context.request.url /docs/api/general/index.html?a=1 the original client request url
context.request.path /docs/api/general/index.html the original request path
action.request.params.path /general/index.md the resource path
action.request.params.rootPath /docs/api The mount root

trieloff pushed a commit that referenced this issue Feb 13, 2019
* Clarify request url, path and introduce root #170

* fixing tests and updating docs

* fix schemas and docus

* don't relay on headers
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants