aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-docs/src/templates
diff options
context:
space:
mode:
authorPascal Mugnier <pascal.mugnier@sonarsource.com>2018-09-19 14:03:27 +0200
committerSonarTech <sonartech@sonarsource.com>2018-09-19 20:20:55 +0200
commit7d7bfd09c1bdbe753899265ef15212b0e4682c32 (patch)
tree6dbd3525482056ae8375a730bb2be26e5eda8485 /server/sonar-docs/src/templates
parent4f5e9d9f87a37dc04fa147667afee85743cab643 (diff)
downloadsonarqube-7d7bfd09c1bdbe753899265ef15212b0e4682c32.tar.gz
sonarqube-7d7bfd09c1bdbe753899265ef15212b0e4682c32.zip
MMF-1420 Ease management of Embedded Docs navigation (#699)
Diffstat (limited to 'server/sonar-docs/src/templates')
-rw-r--r--server/sonar-docs/src/templates/page.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/server/sonar-docs/src/templates/page.js b/server/sonar-docs/src/templates/page.js
index 75b02494ed3..ad61a0fb70c 100644
--- a/server/sonar-docs/src/templates/page.js
+++ b/server/sonar-docs/src/templates/page.js
@@ -51,10 +51,11 @@ export default class Page extends React.PureComponent {
htmlWithInclusions = removeTableOfContents(htmlWithInclusions);
htmlWithInclusions = createAnchorForHeadings(htmlWithInclusions, realHeadingsList);
htmlWithInclusions = replaceDynamicLinks(htmlWithInclusions);
+ htmlWithInclusions = replaceInstanceTag(htmlWithInclusions);
return (
<div css={{ paddingTop: 24, paddingBottom: 24 }}>
- <Helmet title={page.frontmatter.title}>
+ <Helmet title={page.frontmatter.title || 'Documentation'}>
<html lang="en" />
</Helmet>
<HeaderList headers={realHeadingsList} />
@@ -99,6 +100,10 @@ export const query = graphql`
}
`;
+function replaceInstanceTag(content) {
+ return content.replace('{instance}', 'SonarQube');
+}
+
function replaceDynamicLinks(content) {
const version = process.env.GATSBY_DOCS_VERSION || '';
const usePrefix = process.env.GATSBY_USE_PREFIX === '1';
@@ -115,12 +120,6 @@ function replaceDynamicLinks(content) {
'<a href="http$1" target="_blank">$2</a>'
);
- // Add trailing slash to local link
- content = content.replace(
- /\<a href="(?!http)(.*)(?!\/)"\>(.*)\<\/a\>/gim,
- '<a href="$1/">$2</a>'
- );
-
return content.replace(
/\<a href="(.*)\/#(?:sonarqube|sonarcloud|sonarqube-admin)#.*"\>(.*)\<\/a\>/gim,
'$2'