Fixed breadcrumbs

This commit is contained in:
David Ball 2024-03-28 11:02:03 -04:00
parent 6d53fff6f3
commit 5341507431
2 changed files with 7 additions and 1 deletions

View File

@ -23,7 +23,7 @@
<%= h.trimSlashes({path: value.name}) %>
<% } else { %>
<a href="/<%= value.url %>">
<%= h.getDirectoryTitle({directory: value.name}) %>
<%= h.getDirectoryName({directory: value.name}) %>
</a>
<% } %>
<% }); %>

View File

@ -24,6 +24,11 @@ const getSiteName = () => {
const trimSlashes = ({path}) => {
return path.replace(/^[\/\\]|[\/\\]$/g, '');
};
const getDirectoryName = ({directory}) => {
directory = trimSlashes({path: directory});
let title = trimSlashes({path: directory.replace("public", "")}).replaceAll(path.sep, path.posix.sep);
return (directory=="public") ? getSiteName() : title;
};
const getDirectoryTitle = ({directory}) => {
directory = trimSlashes({path: directory});
let title = trimSlashes({path: directory.replace("public", "")}).replaceAll(path.sep, path.posix.sep);
@ -60,6 +65,7 @@ const printReadme = ({directory}) => {
module.exports = {
trimSlashes,
getSiteName,
getDirectoryName,
getDirectoryTitle,
getWelcomeBanner,
shouldShowDirectorySeparator,