From c4e4cbe3ea946d578018b34bda408c9ef469753a Mon Sep 17 00:00:00 2001 From: Greg Back Date: Thu, 28 Oct 2021 10:24:49 -0400 Subject: [PATCH] [doc-links] Ensure correct doc links from main branch Until all repos are switched over to using a "main" branch, all the doc URLs are still published as the "master" version. This also gives us a single place to change once we start publishing them as "main". --- src/core/public/doc_links/doc_links_service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/public/doc_links/doc_links_service.ts b/src/core/public/doc_links/doc_links_service.ts index 0cab7a72adae8..118834a1458cd 100644 --- a/src/core/public/doc_links/doc_links_service.ts +++ b/src/core/public/doc_links/doc_links_service.ts @@ -18,7 +18,9 @@ export class DocLinksService { public setup() {} public start({ injectedMetadata }: StartDeps): DocLinksStart { - const DOC_LINK_VERSION = injectedMetadata.getKibanaBranch(); + const kibanaBranch = injectedMetadata.getKibanaBranch(); + // Documentation for `main` branches is still published at a `master` URL. + const DOC_LINK_VERSION = kibanaBranch === 'main' ? 'master' : kibanaBranch; const ELASTIC_WEBSITE_URL = 'https://www.elastic.co/'; const ELASTICSEARCH_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/elasticsearch/reference/${DOC_LINK_VERSION}/`; const KIBANA_DOCS = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/`;