Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSarah German <sgerman@gitlab.com>2022-09-20 18:36:15 +0300
committerSarah German <sgerman@gitlab.com>2022-09-20 18:36:15 +0300
commit99b35291d54a6979d3e1be70814242f7325bfe27 (patch)
treeb72e6175c278469c0ffe1e24ba0a2ba8ca7877e9
parent2c813f95d9a9f1ebec7f3857d5b0a7f87d1f40a3 (diff)
Trim the title string on the backend
-rw-r--r--content/frontend/search/components/lunr_page.vue2
-rw-r--r--scripts/lunr/preindex.js2
2 files changed, 2 insertions, 2 deletions
diff --git a/content/frontend/search/components/lunr_page.vue b/content/frontend/search/components/lunr_page.vue
index 89afdf56..5edcb04c 100644
--- a/content/frontend/search/components/lunr_page.vue
+++ b/content/frontend/search/components/lunr_page.vue
@@ -64,7 +64,7 @@ export default {
// Add page titles to the result set.
Object.keys(this.results).forEach((key) => {
const contentItem = this.contentMap.find(({ id }) => id === this.results[key].ref);
- this.results[key].title = contentItem.h1.trim();
+ this.results[key].title = contentItem.h1;
});
// Add the search term to the URL to allow linking to result pages.
diff --git a/scripts/lunr/preindex.js b/scripts/lunr/preindex.js
index 9825156e..b883d9a0 100644
--- a/scripts/lunr/preindex.js
+++ b/scripts/lunr/preindex.js
@@ -68,7 +68,7 @@ buildIndex(htmlSrc, (err, filenames) => {
if (title.length) {
pages.push({
id: filename.slice(htmlSrc.length),
- h1: title,
+ h1: title.trim(),
h2: getText($, 'h2'),
h3: getText($, 'h3'),
});