Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support permalinks configured in head matter #101

Closed
ericnakagawa opened this issue Sep 29, 2017 · 8 comments
Closed

Support permalinks configured in head matter #101

ericnakagawa opened this issue Sep 29, 2017 · 8 comments
Assignees
Labels
difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@ericnakagawa
Copy link
Contributor

ericnakagawa commented Sep 29, 2017

Feature Request:

Allow defining a permalink in post and doc markdown frontmatter.

@ericnakagawa ericnakagawa self-assigned this Sep 29, 2017
@JoelMarcey JoelMarcey added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Oct 30, 2017
@steveklabnik
Copy link

What does "permalink" mean in this context? If it's setting the URL that a page is configured at, like I described over here, then a huge 👍 from me.

@JoelMarcey
Copy link
Contributor

Hi @steveklabnik. Yes, like allowing the actual link that is navigated to be different than our default.

e.g.,

permalink: /my/custom/link.html

@JoelMarcey JoelMarcey added mentorship difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. labels Feb 28, 2018
@endiliey endiliey added v2 and removed v2 labels Aug 28, 2018
@endiliey
Copy link
Contributor

endiliey commented Oct 23, 2018

Implemented in v2

Example

---
id: permalink
title: Permalink
permalink: :baseUrl/:docsUrl/:langPart/:versionPart/my/custom/link
---

Lorem ipsum

https://github.com/facebook/Docusaurus/blob/5d60739f7c9263f3f8142f27c85b0180eeb1f19f/v2/lib/load/docs/metadata.js#L117-L134

@zeluspudding
Copy link

zeluspudding commented Apr 21, 2023

How can one map multiple URLs to the same page? I've tried multiple variations of the permalink syntax trying to get an endpoint like example.com/productA/latest to also map to example.com/productA/1.0.2 but I can't seem to make it work. Looking for this approach as we have multiple products we need to version and each should be discoverable via a /latest page.

@slorber
Copy link
Collaborator

slorber commented Apr 21, 2023

How can one map multiple URLs to the same page? I've tried multiple variations of the permalink syntax trying to get an endpoint like example.com/productA/latest to also map to example.com/productA/1.0.2 but I can't seem to make it work. Looking for this approach as we have multiple products we need to version and each should be discoverable via a /latest page.

Docusaurus is only responsible for building static html files.

It is possible to use our client-side redirect plugin to emit extra files at build/productA/latest/xyz.html that would redirect with JS to /productA/1.0.2/xyz, but it is not ideal and you should use your hosting provider features to setup a server redirect (much better for SEO than a client-side redirect).

--

If you do not want a redirect: you can also serve the same content from 2 separate locations.

For example, if you run as a post-build step cp -R build/productA/1.0.2 build/productA/latest

Your pages will then become available at 2 distinct locations: /productA/1.0.2/xyz + /productA/latest/xyz

For both pages, the canonical SEO URL of your page will remain /productA/1.0.2/xyz

@zeluspudding
Copy link

Thank you Sébastien! Being partial to the redirect approach, I've tried it to half success. Seems there's a war between Docusaurus and Render.com to complete the redirection so the browser errors, saying:

This page isn’t working
site.com redirected you too many times.

ERR_TOO_MANY_REDIRECTS

Should I open a new issue for this or is there a known solution for [partially] disabling Docusaurus's internal redirect to 404, which I think is the main culprit? Thanks in advance

@slorber
Copy link
Collaborator

slorber commented Apr 21, 2023

Seems there's a war between Docusaurus and Render.com to complete the redirection so the browser errors, saying:

The only responsibility of Docusaurus is to build static files.

Is Docusaurus producing static files that you do not expect it to produce?

If the static files are ok, then the bug is either in Render or your usage of Render (I can't help much on that, I don't use that host myself)


If you want my help, you will need to provide a built folder with the html files, a live deployment of those html files on render, what you expect, and the problem you see.

If I can't inspect the static files, and see the problem myself, it's very hard to give any help.

@zeluspudding
Copy link

I got my solution here :) Thanks again for all your help!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: advanced Issues that are complex, e.g. large scoping for long-term maintainability. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

6 participants