Customize docs plugin text link

Hi Discourse community,
I enabled discourse-docs plugin and add it to top menu. By default, its link is for example, www.example.com/docs, how can I change it to something like www.example.com/my-docs?

Hi Hyan :wave:

This is not possible. This URL part is hardcoded here:

There’s no setting to change this.

Edit: But you can change it using an environment variable in your app.yml. See @RGJ’s post below

1 Like

Thanks, @Canapin. I do see there’re some sites which docs link customized. Maybe they modify the code somehow. Probably there’re reasons do not expose the config to admin dashboard.

Can you share them?

I got to know that the website customized by code changing. I thought only the line of code needs to change if I would try to do. Mark the answer as resolved. :grinning:

The whole idea of that setting is to make it configurable. The only thing that’s hardcoded is the default value.

You can set DISCOURSE_DOCS_PATH in your app.yml to change it.

3 Likes

I’ve added a section to the doc :+1: https://meta.discourse.org/t/discourse-docs-documentation-management/130172#renaming-the-docs-path-5

5 Likes

Oh. Thank you so much letting me know this env vars. @RGJ I have one more questions regarding how Discourse or Rails framework works. I assume if the Discourse or its plugins running behavior can be changed through an env variable, then there must be the same env var name mentioned its relevant code. In this case DISCOURSE_DOCS_PATH should be appeared in the code of GitHub - discourse/discourse-docs, but I didn’t find any code related. How it works?

A very short summary is that environment variables DISCOURSE_XYZ are available in code as GlobalSettings.xyz or SiteSettings.xyz.

In this specific case you can find GlobalSettings.docs_path here.

2 Likes

Thank, @RGJ Get to know how the environment setting names maps the config in Discourse.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.