From e87e2646cf67aaa23b87ca1e77714cdf58fe0be4 Mon Sep 17 00:00:00 2001 From: Erick Velez Date: Tue, 16 Dec 2025 18:41:03 -0800 Subject: [PATCH] [clang-doc] Add a "Home" link to navbar (#171900) This patch removes the old buttons and adds a link to the homepage. --- clang-tools-extra/clang-doc/HTMLGenerator.cpp | 7 +++++++ .../clang-doc/assets/navbar-template.mustache | 5 +---- .../clang-doc/basic-project.mustache.test | 20 ++++--------------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/clang-tools-extra/clang-doc/HTMLGenerator.cpp b/clang-tools-extra/clang-doc/HTMLGenerator.cpp index 3fc89311749a..1af555a5b772 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 178d147a556d..2767d5af8666 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 @@ 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 d406c9f29796..26e42280f347 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: HTML-SHAPE: @@ -135,10 +132,7 @@ HTML-CALC: HTML-CALC: @@ -339,10 +333,7 @@ HTML-RECTANGLE: HTML-RECTANGLE: @@ -457,10 +448,7 @@ HTML-CIRCLE: HTML-CIRCLE: