From 950bb9456f942acd13738cae4b6b052aa2f85440 Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Wed, 28 Feb 2024 11:41:02 +0900 Subject: [PATCH 1/2] chore: don't overwrite _disabledToc when explicitly defined --- samples/seed/index.md | 1 + templates/default/ManagedReference.html.primary.js | 4 +++- templates/default/RestApi.html.primary.js | 4 +++- templates/default/UniversalReference.html.primary.js | 4 +++- templates/default/conceptual.html.primary.js | 4 +++- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/samples/seed/index.md b/samples/seed/index.md index 87c2bd3cae9..51c4f1b25b7 100644 --- a/samples/seed/index.md +++ b/samples/seed/index.md @@ -1,5 +1,6 @@ --- _disableNewTab: true +_disableToc: false _lang: zh-CN _layout: landing _appLogoUrl: https://github.com/dotnet/docfx diff --git a/templates/default/ManagedReference.html.primary.js b/templates/default/ManagedReference.html.primary.js index a7e26506e1d..f5b306e9458 100644 --- a/templates/default/ManagedReference.html.primary.js +++ b/templates/default/ManagedReference.html.primary.js @@ -23,7 +23,9 @@ exports.transform = function (model) { model.isClass = false; model.isEnum = true; } - model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + if(model._disableToc === undefined) { + model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + } model._disableNextArticle = true; if (extension && extension.postTransform) { diff --git a/templates/default/RestApi.html.primary.js b/templates/default/RestApi.html.primary.js index c2149596a72..b148bb2d919 100644 --- a/templates/default/RestApi.html.primary.js +++ b/templates/default/RestApi.html.primary.js @@ -12,7 +12,9 @@ exports.transform = function (model) { if (restApiCommon && restApiCommon.transform) { model = restApiCommon.transform(model); } - model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + if(model._disableToc === undefined) { + model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + } model._disableNextArticle = true; if (extension && extension.postTransform) { diff --git a/templates/default/UniversalReference.html.primary.js b/templates/default/UniversalReference.html.primary.js index 121b48fcf8d..535fbf43846 100644 --- a/templates/default/UniversalReference.html.primary.js +++ b/templates/default/UniversalReference.html.primary.js @@ -13,7 +13,9 @@ exports.transform = function (model) { model = urefCommon.transform(model); } - model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + if(model._disableToc === undefined) { + model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + } model._disableNextArticle = true; if (extension && extension.postTransform) { diff --git a/templates/default/conceptual.html.primary.js b/templates/default/conceptual.html.primary.js index b06e0c3a40c..19d24791e6d 100644 --- a/templates/default/conceptual.html.primary.js +++ b/templates/default/conceptual.html.primary.js @@ -9,7 +9,9 @@ exports.transform = function (model) { model = extension.preTransform(model); } - model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + if(model._disableToc === undefined) { + model._disableToc = model._disableToc || !model._tocPath || (model._navPath === model._tocPath); + } model.docurl = model.docurl || common.getImproveTheDocHref(model, model._gitContribute, model._gitUrlPattern); if (extension && extension.postTransform) { From 4cfbaa7177cbb84b2081f5ff4984499a6e52f80d Mon Sep 17 00:00:00 2001 From: filzrev <103790468+filzrev@users.noreply.github.com> Date: Fri, 1 Mar 2024 16:59:36 +0900 Subject: [PATCH 2/2] chore: remove unused _disableToc metadata --- samples/seed/index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/seed/index.md b/samples/seed/index.md index 51c4f1b25b7..87c2bd3cae9 100644 --- a/samples/seed/index.md +++ b/samples/seed/index.md @@ -1,6 +1,5 @@ --- _disableNewTab: true -_disableToc: false _lang: zh-CN _layout: landing _appLogoUrl: https://github.com/dotnet/docfx