From 5bc49ed0b39dd07ddca65df83f4ac0514b0d6674 Mon Sep 17 00:00:00 2001
From: Evan Read <eread@gitlab.com>
Date: Thu, 13 Feb 2025 02:37:20 +0000
Subject: [PATCH] Rename final index files for compatibility with Hugo
 publishing

---
 .gitlab/ci/rules.gitlab-ci.yml                       | 12 ++++++------
 .../super_sidebar/components/help_center.vue         |  2 +-
 doc/{index.md => _index.md}                          |  0
 doc/administration/get_started.md                    |  2 +-
 doc/development/documentation/help.md                |  2 +-
 .../documentation/site_architecture/automation.md    |  2 +-
 doc/legal/{index.md => _index.md}                    |  0
 doc/security/hardening_cicd_recommendations.md       |  2 +-
 doc/user/markdown.md                                 |  6 +++---
 doc/user/project/settings/import_export.md           |  4 ++--
 scripts/verify-tff-mapping                           |  2 +-
 .../shared_context_and_examples.rb                   |  2 +-
 .../super_sidebar/components/help_center_spec.js     |  2 +-
 spec/haml_lint/linter/documentation_links_spec.rb    | 12 ++++++------
 tests.yml                                            |  2 +-
 15 files changed, 26 insertions(+), 26 deletions(-)
 rename doc/{index.md => _index.md} (100%)
 rename doc/legal/{index.md => _index.md} (100%)

diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml
index ac70807b3f49..d523c2cce15a 100644
--- a/.gitlab/ci/rules.gitlab-ci.yml
+++ b/.gitlab/ci/rules.gitlab-ci.yml
@@ -401,7 +401,7 @@
   - "scripts/rspec_helpers.sh"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
 
 .search-backend-patterns: &search-backend-patterns
@@ -508,7 +508,7 @@
   - "{,jh/}.gitlab/ci/**/*"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
 
 # .code-patterns + .backstage-patterns
@@ -537,7 +537,7 @@
   - "{,jh/}.gitlab/ci/**/*"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
   # Backstage changes
   - "Dangerfile"
@@ -574,7 +574,7 @@
   - "{,jh/}.gitlab/ci/**/*"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
   # QA changes
   - ".dockerignore"
@@ -617,7 +617,7 @@
   - "{,jh/}qa/**/*"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
 
 # .code-backstage-qa-patterns + .workhorse-patterns
@@ -649,7 +649,7 @@
   - "{,jh/}.gitlab/ci/**/*"
   # Mapped patterns (see tests.yml)
   - "data/whats_new/*.yml"
-  - "doc/index.md"
+  - "doc/_index.md"
   - "doc/api/settings.md"
   # Backstage changes
   - "Dangerfile"
diff --git a/app/assets/javascripts/super_sidebar/components/help_center.vue b/app/assets/javascripts/super_sidebar/components/help_center.vue
index 0863b3e57166..4cebc247454a 100644
--- a/app/assets/javascripts/super_sidebar/components/help_center.vue
+++ b/app/assets/javascripts/super_sidebar/components/help_center.vue
@@ -88,7 +88,7 @@ export default {
             },
             {
               text: this.$options.i18n.contribute,
-              href: helpPagePath('', { anchor: 'contribute-to-gitlab' }),
+              href: helpPagePath('_index.md', { anchor: 'contribute-to-gitlab' }),
               extraAttrs: {
                 ...this.trackingAttrs('contribute_to_gitlab'),
               },
diff --git a/doc/index.md b/doc/_index.md
similarity index 100%
rename from doc/index.md
rename to doc/_index.md
diff --git a/doc/administration/get_started.md b/doc/administration/get_started.md
index ded6bcd39b04..769ee0c9a07d 100644
--- a/doc/administration/get_started.md
+++ b/doc/administration/get_started.md
@@ -231,7 +231,7 @@ If you use GitLab SaaS, you have several channels with which to get support and
 
 To get assistance for GitLab SaaS:
 
-- Access [GitLab Docs](../index.md) for self-service support.
+- Access [GitLab Docs](../_index.md) for self-service support.
 - Join the [GitLab Forum](https://forum.gitlab.com/) for community support.
 - Gather [your subscription information](https://about.gitlab.com/support/#for-self-managed-users) before submitting a ticket.
 - Submit a support ticket for:
diff --git a/doc/development/documentation/help.md b/doc/development/documentation/help.md
index eb96aeb823f4..b3edf9cbba9c 100644
--- a/doc/development/documentation/help.md
+++ b/doc/development/documentation/help.md
@@ -156,5 +156,5 @@ Do not use `include ActionView::Helpers::UrlHelper` just to make the `link_to` m
 ## `/help` tests
 
 Several [RSpec tests](https://gitlab.com/gitlab-org/gitlab/-/blob/master/spec/features/help_pages_spec.rb)
-are run to ensure GitLab documentation renders and works correctly. In particular, that [main docs landing page](../../index.md) works correctly from `/help`.
+are run to ensure GitLab documentation renders and works correctly. In particular, that [main docs landing page](../../_index.md) works correctly from `/help`.
 For example, [GitLab.com's `/help`](https://gitlab.com/help).
diff --git a/doc/development/documentation/site_architecture/automation.md b/doc/development/documentation/site_architecture/automation.md
index 33320f7a5660..aed0f5c1b0b8 100644
--- a/doc/development/documentation/site_architecture/automation.md
+++ b/doc/development/documentation/site_architecture/automation.md
@@ -50,7 +50,7 @@ that are coded across multiple repositories.
 | [Available custom role permissions](../../../user/custom_roles/abilities.md) | [Generated by Rake task](https://gitlab.com/gitlab-org/gitlab/-/blob/master/tooling/custom_roles/docs/templates/custom_abilities.md.erb) | [Authorization](https://handbook.gitlab.com/handbook/product/categories/#authorization-group)|
 | [Application settings analysis](../../cells/application_settings_analysis.md) | [Generated by Ruby script](https://gitlab.com/gitlab-org/gitlab/-/blob/2bb2910c84fad965bde473aa2881d88358b6e96e/scripts/cells/application-settings-analysis.rb#L353) | |
 | DAST vulnerability check documentation ([Example](../../../user/application_security/dast/browser/checks/798.19.md)) | [How to generate the Markdown](https://gitlab.com/gitlab-org/security-products/dast-cwe-checks/-/blob/main/doc/how-to-generate-the-markdown-documentation.md) | [Dynamic Analysis](https://handbook.gitlab.com/handbook/product/categories/#dynamic-analysis-group) |
-| [The docs homepage](../../../index.md) |  | [Technical Writing](https://handbook.gitlab.com/handbook/product/ux/technical-writing/) |
+| [The docs homepage](../../../_index.md) |  | [Technical Writing](https://handbook.gitlab.com/handbook/product/ux/technical-writing/) |
 
 ## Make an automation request
 
diff --git a/doc/legal/index.md b/doc/legal/_index.md
similarity index 100%
rename from doc/legal/index.md
rename to doc/legal/_index.md
diff --git a/doc/security/hardening_cicd_recommendations.md b/doc/security/hardening_cicd_recommendations.md
index bffa6cd3c2c8..a668eb9afc52 100644
--- a/doc/security/hardening_cicd_recommendations.md
+++ b/doc/security/hardening_cicd_recommendations.md
@@ -25,7 +25,7 @@ information to help harden the CI/CD process.
   container technology should be used, such as GCP Secret Manager, AWS KMS, or
   HashiCorp Vault. For self-managed and standalone instances, HashiCorp Vault is
   recommended, and many GitLab features can take advantage of Vault and are well
-  documented in the main [Documentation](../index.md). For detailed CI/CD examples, see [using external secrets in CI](../ci/secrets/_index.md).
+  documented in the main [Documentation](../_index.md). For detailed CI/CD examples, see [using external secrets in CI](../ci/secrets/_index.md).
 - **External Communications**. If your CI/CD process requires connectivity to other
   hosts, ensure that these communication channels are encrypted. You should use TLS 1.2 or 1.3, and where possible implement mutual TLS.
 - **Logging**. Logging can be very important for auditing and troubleshooting, so it
diff --git a/doc/user/markdown.md b/doc/user/markdown.md
index 9eb14a7c3043..ba197c923aea 100644
--- a/doc/user/markdown.md
+++ b/doc/user/markdown.md
@@ -592,7 +592,7 @@ Do not change it back to a markdown codeblock.
 
 <pre class="highlight"><code>- This line shows an [inline-style link](https://www.google.com)
 - This line shows a [link to a repository file in the same directory](permissions.md)
-- This line shows a [relative link to a file one directory higher](../index.md)
+- This line shows a [relative link to a file one directory higher](../_index.md)
 - This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
 
 Using heading ID anchors:
@@ -615,7 +615,7 @@ Some text to show that the reference links can follow later.
 
 - This line shows an [inline-style link](https://www.google.com)
 - This line shows a [link to a repository file in the same directory](permissions.md)
-- This line shows a [relative link to a file one directory higher](../index.md)
+- This line shows a [relative link to a file one directory higher](../_index.md)
 - This line shows a [link that also has title text](https://www.google.com "This link takes you to Google!")
 
 Using heading ID anchors:
@@ -1674,7 +1674,7 @@ the content. This data can be used by static site generators like [Jekyll](https
 When you view a Markdown file rendered by GitLab, front matter is displayed as-is,
 in a box at the top of the document. The HTML content displays after the front matter. To view an example,
 you can toggle between the source and rendered version of a
-[GitLab documentation file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/index.md).
+[GitLab documentation file](https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/_index.md).
 
 In GitLab, front matter is used only in Markdown files and wiki pages, not the other
 places where Markdown formatting is supported. It must be at the very top of the document
diff --git a/doc/user/project/settings/import_export.md b/doc/user/project/settings/import_export.md
index 5b4a833daf94..f6ecab07957f 100644
--- a/doc/user/project/settings/import_export.md
+++ b/doc/user/project/settings/import_export.md
@@ -125,7 +125,7 @@ and vice versa, assuming [compatibility](#compatibility) is met.
 
 If you're exporting a project from the Enterprise Edition to the Community Edition, you may lose
 data that is retained only in the Enterprise Edition. For more information, see
-[downgrading from EE to CE](../../../index.md).
+[downgrading from EE to CE](../../../downgrade_ee_to_ce/_index.md).
 
 ### Export a project and its data
 
@@ -335,7 +335,7 @@ Professional Services team.
 - You can export groups from the [Community Edition to the Enterprise Edition](https://about.gitlab.com/install/ce-or-ee/)
   and vice versa. The Enterprise Edition retains some group data that isn't part of the Community Edition. If you're
   exporting a group from the Enterprise Edition to the Community Edition, you may lose this data. For more information,
-  see [downgrading from EE to CE](../../../index.md).
+  see [downgrading from EE to CE](../../../downgrade_ee_to_ce/_index.md).
 
 The maximum import file size depends on whether you import to GitLab Self-Managed or GitLab.com:
 
diff --git a/scripts/verify-tff-mapping b/scripts/verify-tff-mapping
index bf4a327b034d..bc1282215255 100755
--- a/scripts/verify-tff-mapping
+++ b/scripts/verify-tff-mapping
@@ -204,7 +204,7 @@ tests = [
 
   {
     explanation: 'The documentation index page is used in this haml_lint spec',
-    changed_file: 'doc/index.md',
+    changed_file: 'doc/_index.md',
     expected: ['spec/haml_lint/linter/documentation_links_spec.rb']
   },
 
diff --git a/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb b/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
index 1c13c6cf0dbb..0ea76a57f148 100644
--- a/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
+++ b/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
@@ -24,7 +24,7 @@
   let_it_be(:gitlab_org_gitlab_project) { create(:project, :empty_repo, group: group, path: 'gitlab') }
   let_it_be(:user) { create(:user) }
   let_it_be(:ci_glob) { Dir.glob("{.gitlab-ci.yml,.gitlab/**/*.yml}").freeze }
-  let_it_be(:ci_glob_with_common_file_globs) { [*ci_glob, 'lib/api/lint.rb', 'doc/index.md'] }
+  let_it_be(:ci_glob_with_common_file_globs) { [*ci_glob, 'lib/api/lint.rb', 'doc/_index.md'] }
   let_it_be(:master_branch) { 'master' }
 
   around do |example|
diff --git a/spec/frontend/super_sidebar/components/help_center_spec.js b/spec/frontend/super_sidebar/components/help_center_spec.js
index b46ec391942a..65c2e5b73d6f 100644
--- a/spec/frontend/super_sidebar/components/help_center_spec.js
+++ b/spec/frontend/super_sidebar/components/help_center_spec.js
@@ -77,7 +77,7 @@ describe('HelpCenter component', () => {
     },
     {
       text: HelpCenter.i18n.contribute,
-      href: helpPagePath('', { anchor: 'contribute-to-gitlab' }),
+      href: helpPagePath('_index.md', { anchor: 'contribute-to-gitlab' }),
       extraAttrs: trackingAttrs('contribute_to_gitlab'),
     },
     {
diff --git a/spec/haml_lint/linter/documentation_links_spec.rb b/spec/haml_lint/linter/documentation_links_spec.rb
index f1a7e4146be7..a1e23058bf57 100644
--- a/spec/haml_lint/linter/documentation_links_spec.rb
+++ b/spec/haml_lint/linter/documentation_links_spec.rb
@@ -11,13 +11,13 @@
 
   shared_examples 'link validation rules' do |link_pattern|
     context 'when link_to points to the existing file path' do
-      let(:haml) { "= link_to 'Description', #{link_pattern}('index.md')" }
+      let(:haml) { "= link_to 'Description', #{link_pattern}('_index.md')" }
 
       it { is_expected.not_to report_lint }
     end
 
     context 'when link_to points to the existing file with valid anchor' do
-      let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', anchor: 'user-accounts'), target: '_blank'" }
+      let(:haml) { "= link_to 'Description', #{link_pattern}('_index.md', anchor: 'user-accounts'), target: '_blank'" }
 
       it { is_expected.not_to report_lint }
     end
@@ -29,12 +29,12 @@
     end
 
     context 'when anchor is not correct' do
-      let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', anchor: 'wrong')" }
+      let(:haml) { "= link_to 'Description', #{link_pattern}('_index.md', anchor: 'wrong')" }
 
       it { is_expected.to report_lint }
 
       context "when #{link_pattern} has multiple options" do
-        let(:haml) { "= link_to 'Description', #{link_pattern}('index.md', key: :value, anchor: 'wrong')" }
+        let(:haml) { "= link_to 'Description', #{link_pattern}('_index.md', key: :value, anchor: 'wrong')" }
 
         it { is_expected.to report_lint }
       end
@@ -65,7 +65,7 @@
     end
 
     context 'when anchor belongs to a different element' do
-      let(:haml) { "= link_to 'Description', #{link_pattern}('index.md'), target: (anchor: 'blank')" }
+      let(:haml) { "= link_to 'Description', #{link_pattern}('_index.md'), target: (anchor: 'blank')" }
 
       it { is_expected.not_to report_lint }
     end
@@ -89,7 +89,7 @@
     end
 
     context 'when the second link is invalid' do
-      let(:haml) { ".data-form{ data: { url: #{link_pattern}('index.md'), wrong_url: #{link_pattern}('wrong') } }" }
+      let(:haml) { ".data-form{ data: { url: #{link_pattern}('_index.md'), wrong_url: #{link_pattern}('wrong') } }" }
 
       it { is_expected.to report_lint }
     end
diff --git a/tests.yml b/tests.yml
index 48a40a20c4a2..778e0759fb1c 100644
--- a/tests.yml
+++ b/tests.yml
@@ -110,7 +110,7 @@ mapping:
     test: 'spec/lib/release_highlights/validator_spec.rb'
 
   # The documentation index page is used in this haml_lint spec
-  - source: 'doc/index\.md'
+  - source: 'doc/_index\.md'
     test: 'spec/haml_lint/linter/documentation_links_spec.rb'
 
   - source: '(?<prefix>ee/)?app/models/.+\.rb'
-- 
GitLab