Skip to content

Commit

Permalink
CLDR-18001 site: updates to top title
Browse files Browse the repository at this point in the history
- related to CLDR-18017
- suppress redundant h1 (#), but add centered title
- suppress title from ToC. Hide ToC if empty.
  • Loading branch information
srl295 committed Oct 10, 2024
1 parent d55f4a5 commit b41632c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
26 changes: 18 additions & 8 deletions docs/site/assets/css/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -808,23 +808,21 @@ body.page .subpages a.hasChildren:after {
}

/* these are the ToC entries in the sidebar, according to what element they came from originally. */
.pagecontents .headingH1 {
margin-left: 0em;
}
.pagecontents .headingH1,
.pagecontents .headingH2 {
margin-left: 1em;
margin-left: 0em;
}
.pagecontents .headingH3 {
margin-left: 2em;
margin-left: 1em;
}
.pagecontents .headingH4 {
margin-left: 3em;
margin-left: 2em;
}
.pagecontents .headingH5 {
margin-left: 4em;
margin-left: 3em;
}
.pagecontents .headingH6 {
margin-left: 5em;
margin-left: 4em;
}

header {
Expand Down Expand Up @@ -908,6 +906,10 @@ div.sitemap {
padding-left: 0.25em;
}

.topTitle {
display: none;
}

div.sitemap {
height: 90%;
}
Expand Down Expand Up @@ -1010,6 +1012,14 @@ div > header {
display: none !important;
}

section.body h1.title {
text-align: center;
}

section.body h1.redundantTitle {
display: none;
}

section.body h1 {
font-size: 2em;
line-height: 1.2;
Expand Down
31 changes: 7 additions & 24 deletions docs/site/assets/js/cldrsite.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,14 +330,7 @@ const app = Vue.createApp(
<AncestorPages :ancestorPages="ancestorPages"/>
<div v-if="!children || !children.length" class="title"> {{ ourTitle }} </div>
<div v-else class="title" >
{{ ourTitle }}
</div>
<a class="showmap" href="/sitemap">Site Map</a>
<a class="showmap" href="/sitemap">Site Map</a>
</div>`,
},
Expand Down Expand Up @@ -489,23 +482,10 @@ if (myPath === "sitemap.html") {
style: `heading${tagName}`,
})
);
if (!objects?.length) return null;
if (objects[0].title === this.ourTitle) {
// redundant title - change the link to go to the entire page
objects[0].style = "headingH1 topTitle";
objects[0].href = "";
} else {
// synthesize a title entry in the ToC
objects = [
{
title: this.ourTitle,
href: "",
children: null,
style: "headingH1 topTitle",
},
...objects,
];
if (objects[0]?.title === this.ourTitle) {
objects = objects.slice(1);
}
if (!objects?.length) return null;
return objects;
},
ourTitle() {
Expand All @@ -521,9 +501,12 @@ if (myPath === "sitemap.html") {
},
},
template: `
<div>
<div class="navBar" v-if="contents || (children.length)">
<PageContents v-if="contents" :children="contents" />
<SubPagesPopup v-if="children.length" :children="children"/>
</div>
<h1 class="title">{{ ourTitle }}</h1>
</div>`,
},
{
Expand Down

0 comments on commit b41632c

Please sign in to comment.