Customize docs plugin text link

AI-generated summary

Customize docs plugin text link

The discussion revolves around customizing the URL of the discourse-docs plugin. Hyan wants to change the default link from www.example.com/docs to www.example.com/my-docs.

Canapin initially states that this is not possible as the URL is hardcoded, but later mentions that it can be changed using an environment variable in app.yml.

RGJ clarifies that the setting is intended to be configurable and can be changed by setting DISCOURSE_DOCS_PATH in app.yml.

Hyan successfully customizes the link by changing the code and later discovers the environment variable method.

JammyDodger adds documentation on renaming the docs path.

RGJ explains how environment variables are used in the code, specifically that DISCOURSE_XYZ variables are available as GlobalSettings.xyz or SiteSettings.xyz.

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

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.

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

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 · GitHub, 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.

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