Skip to content

Conversation

@evelez7
Copy link
Member

@evelez7 evelez7 commented Dec 11, 2025

This patch removes the old buttons and adds a link to the homepage.

Copy link
Member Author

evelez7 commented Dec 11, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@evelez7 evelez7 requested review from ilovepi and petrhosek December 11, 2025 20:48
@evelez7 evelez7 marked this pull request as ready for review December 11, 2025 20:48
@llvmbot
Copy link
Member

llvmbot commented Dec 11, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Erick Velez (evelez7)

Changes

This patch removes the old buttons and adds a link to the homepage.


Full diff: https://github.com/llvm/llvm-project/pull/171900.diff

3 Files Affected:

  • (modified) clang-tools-extra/clang-doc/HTMLGenerator.cpp (+7)
  • (modified) clang-tools-extra/clang-doc/assets/navbar-template.mustache (+1-4)
  • (modified) clang-tools-extra/test/clang-doc/basic-project.mustache.test (+4-16)
diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
index 3fc89311749ad..1af555a5b772b 100644
--- a/clang-tools-extra/clang-doc/HTMLGenerator.cpp
+++ b/clang-tools-extra/clang-doc/HTMLGenerator.cpp
@@ -120,6 +120,13 @@ Error HTMLGenerator::setupTemplateResources(const ClangDocContext &CDCtx,
     SCA->emplace_back(JsPath);
   }
   V.getAsObject()->insert({"Scripts", ScriptArr});
+  if (RelativeRootPath.empty()) {
+    RelativeRootPath = "";
+  } else {
+    sys::path::append(RelativeRootPath, "/index.html");
+    sys::path::native(RelativeRootPath, sys::path::Style::posix);
+  }
+  V.getAsObject()->insert({"Homepage", RelativeRootPath});
   return Error::success();
 }
 
diff --git a/clang-tools-extra/clang-doc/assets/navbar-template.mustache b/clang-tools-extra/clang-doc/assets/navbar-template.mustache
index 178d147a556d3..2767d5af86668 100644
--- a/clang-tools-extra/clang-doc/assets/navbar-template.mustache
+++ b/clang-tools-extra/clang-doc/assets/navbar-template.mustache
@@ -8,10 +8,7 @@
         <div class="navbar__menu">
             <ul class="navbar__links">
                 <li class="navbar__item">
-                    <a href="/" class="navbar__link">Namespace</a>
-                </li>
-                <li class="navbar__item">
-                    <a href="/" class="navbar__link">Class</a>
+                    <a href="{{Homepage}}" class="navbar__link">Home</a>
                 </li>
             </ul>
         </div>
diff --git a/clang-tools-extra/test/clang-doc/basic-project.mustache.test b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
index d406c9f297960..26e42280f3474 100644
--- a/clang-tools-extra/test/clang-doc/basic-project.mustache.test
+++ b/clang-tools-extra/test/clang-doc/basic-project.mustache.test
@@ -25,10 +25,7 @@ HTML-SHAPE:             </div>
 HTML-SHAPE:         <div class="navbar__menu">
 HTML-SHAPE:             <ul class="navbar__links">
 HTML-SHAPE:                 <li class="navbar__item">
-HTML-SHAPE:                     <a href="/" class="navbar__link">Namespace</a>
-HTML-SHAPE:                 </li>
-HTML-SHAPE:                 <li class="navbar__item">
-HTML-SHAPE:                     <a href="/" class="navbar__link">Class</a>
+HTML-SHAPE:                     <a href="../index.html" class="navbar__link">Home</a>
 HTML-SHAPE:                 </li>
 HTML-SHAPE:             </ul>
 HTML-SHAPE:         </div>
@@ -135,10 +132,7 @@ HTML-CALC:             </div>
 HTML-CALC:         <div class="navbar__menu">
 HTML-CALC:             <ul class="navbar__links">
 HTML-CALC:                 <li class="navbar__item">
-HTML-CALC:                     <a href="/" class="navbar__link">Namespace</a>
-HTML-CALC:                 </li>
-HTML-CALC:                 <li class="navbar__item">
-HTML-CALC:                     <a href="/" class="navbar__link">Class</a>
+HTML-CALC:                     <a href="../index.html" class="navbar__link">Home</a>
 HTML-CALC:                 </li>
 HTML-CALC:             </ul>
 HTML-CALC:         </div>
@@ -339,10 +333,7 @@ HTML-RECTANGLE:             </div>
 HTML-RECTANGLE:         <div class="navbar__menu">
 HTML-RECTANGLE:             <ul class="navbar__links">
 HTML-RECTANGLE:                 <li class="navbar__item">
-HTML-RECTANGLE:                     <a href="/" class="navbar__link">Namespace</a>
-HTML-RECTANGLE:                 </li>
-HTML-RECTANGLE:                 <li class="navbar__item">
-HTML-RECTANGLE:                     <a href="/" class="navbar__link">Class</a>
+HTML-RECTANGLE:                     <a href="../index.html" class="navbar__link">Home</a>
 HTML-RECTANGLE:                 </li>
 HTML-RECTANGLE:             </ul>
 HTML-RECTANGLE:         </div>
@@ -457,10 +448,7 @@ HTML-CIRCLE:             </div>
 HTML-CIRCLE:         <div class="navbar__menu">
 HTML-CIRCLE:             <ul class="navbar__links">
 HTML-CIRCLE:                 <li class="navbar__item">
-HTML-CIRCLE:                     <a href="/" class="navbar__link">Namespace</a>
-HTML-CIRCLE:                 </li>
-HTML-CIRCLE:                 <li class="navbar__item">
-HTML-CIRCLE:                     <a href="/" class="navbar__link">Class</a>
+HTML-CIRCLE:                     <a href="../index.html" class="navbar__link">Home</a>
 HTML-CIRCLE:                 </li>
 HTML-CIRCLE:             </ul>
 HTML-CIRCLE:         </div>

Copy link
Member Author

evelez7 commented Dec 11, 2025

@evelez7 evelez7 force-pushed the users/evelez7/clang-doc-index-page branch from 5224012 to 9e214dd Compare December 11, 2025 20:53
@evelez7 evelez7 force-pushed the users/evelez7/clang-doc-fix-navbar-link branch from 00f3570 to d54ed0d Compare December 11, 2025 20:53
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

🪟 Windows x64 Test Results

  • 2987 tests passed
  • 30 tests skipped

✅ The build succeeded and all tests passed.

@github-actions
Copy link

github-actions bot commented Dec 11, 2025

🐧 Linux x64 Test Results

  • 3049 tests passed
  • 7 tests skipped

✅ The build succeeded and all tests passed.

This patch removes the old buttons and adds a link to the homepage.
@evelez7 evelez7 force-pushed the users/evelez7/clang-doc-index-page branch from 9e214dd to 655f299 Compare December 11, 2025 21:12
@evelez7 evelez7 force-pushed the users/evelez7/clang-doc-fix-navbar-link branch from d54ed0d to 24e5f13 Compare December 11, 2025 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants