diff --git a/app/page/router.mts b/app/page/router.mts index 5de577a0..992dde71 100644 --- a/app/page/router.mts +++ b/app/page/router.mts @@ -173,7 +173,16 @@ export default function () { else { let info = JSON.parse((await readFile(fullFilePath)).toString()); let subtitleVTT = fs.existsSync(subtitleFile) ? (await readFile(subtitleFile)).toString() : ''; - const renderData = { route, filePath, fullFilePath, req, paths, directory: path.join('public', directory), videoURL, subtitleURL, subtitleVTT, info }; + let breadcrumbs: Breadcrumb[] = []; + paths.forEach((path, index, paths) => { + if (index == 0) { + breadcrumbs.push({ title: config.siteName, url: '/' }); + } + else { + breadcrumbs.push({ title: helpers.getDirectoryName(path.name).replaceAll('_', ' ').replaceAll('-', ' '), url: `/${path.url}` }); + } + }); + const renderData = { breadcrumbs, route, filePath, fullFilePath, req, paths, directory: path.join('public', directory), videoURL, subtitleURL, subtitleVTT, info }; res.render("video-player", { h: helpers, ...renderData }); } }); diff --git a/app/server.mts b/app/server.mts index 902105a6..782ac3db 100644 --- a/app/server.mts +++ b/app/server.mts @@ -27,7 +27,7 @@ console.log(`Assigning /search route to search router.`); app.use('/search', searchRouter()); // app.use('/advanced-search', advancedSearch.router); -// Search endpoints +// Page endpoints console.log(`Assigning / route to page router.`); app.use('/', pageRouter()); diff --git a/app/views/video-player.ejs b/app/views/video-player.ejs index 8a0bdda7..fb47e710 100644 --- a/app/views/video-player.ejs +++ b/app/views/video-player.ejs @@ -12,25 +12,7 @@
-

- <% paths.forEach(function(value, index) { %> - <% if (h.shouldShowDirectorySeparator(index)) { %> - - <% } %> - <% if (h.shouldShowSiteWelcomeMessage(paths)) { %> -   - <%= h.getSiteWelcomeMessage() %> - <% } else if (h.shouldOmitLinkOnLastBreadcrumb(paths, index)) { %> - <%= h.trimSlashes(value.name) %> - <% } else if (index == 0) { %> - <%= h.getSiteName() %> - <% } else { %> - - <%= h.getDirectoryName(value.name) %> - - <% } %> - <% }); %> -

+ <%- include('./includes/breadcrumbs.ejs') %>
<% if (typeof videoURL !== 'undefined') {%>