Search code examples
urldocpad

does docpad secondary url redirect feature work?


Based on the documentation of docpad primary url, all requests to a document secondary url should be redirected to the primary url. But actually it respond the expected page directly when requesting any secondary urls without any redirection.

For example, you have a docpad document /src/documents/secondary-url.html.md like:

---
urls:
 - '/my-secondary-urls1'
 - '/my-secondary-urls2'
---

# primary url should be `secondary-url.html`

Then run command $ docpad run

It will responds status 200 when hitting either http://localhost:9778/my-secondary-urls1 or http://localhost:9778/my-secondary-urls2. While expected result is a redirect with status code 301 to http://localhost:9778/secondary-url.html

It seems an expected feature if checking this line of docpad code.

I'm curious if this is a defect or a deprecated feature?

BTW: I have a simple fix here which won't become a pull request until I read the contribution guide: https://github.com/shawnzhu/docpad/commit/731cdec43f9d9d155c8a8310494575d9746a065c


Solution

  • This was addressed in issue 850 of project docpad, and fixed in pull request 905, so further version than v6.70.1 of docpad will contain this fix.