Link to project's GitLab pages from README

5.6k Views Asked by At

I'd like to insert into the README.md file a link to the project's GitLab pages URL without hardcoding it.

Something like:

Visit the project's [pages site]($PROJECT_NAME_PAGES_URL)

instead of

Visit the project's [pages site](https://namespace.gitlab.io/project-name)

Is it possible?

1

There are 1 best solutions below

0
On BEST ANSWER

No, GitLab-flavored markdown does not support any variables/substitutions like this. There are some cases where special gitlab references are allowed, but the GitLab pages URL is not one of them.

The only workaround might be to have a CI job that parses a readme template and updates the README.md on changes, obtaining the pages url from the predefined CI variable $CI_PAGES_URL -- something like what is described in this answer to a similar question.