11<template >
22 <div class =" breadcrumb-wrapper" >
3- <span class =" breadcrumb-title" >{{ siteTitle }}:</span >
4- <router-link class =" breadcrumb" v-for =" crumb in breadCrumbs" :key =" crumb.path" :to =" crumb.path" >
3+ <router-link
4+ v-for =" (crumb, index) in breadCrumbs"
5+ :key =" crumb.path"
6+ class =" breadcrumb"
7+ :to =" crumb.path"
8+ >
59 {{ crumb.title }}
610 </router-link >
711 </div >
812</template >
913
1014<script setup>
11- import {computed , inject } from " vue" ;
12- import {usePageData , useSiteData } from " @vuepress/client" ;
15+ import { computed , inject } from " vue" ;
16+ import { usePageData , useSiteData } from " @vuepress/client" ;
17+
18+ const page = usePageData ();
19+ const site = useSiteData ();
20+ const { locales: { siteTitle } } = inject (" themeConfig" );
21+
22+ // Title mapping for specific paths
23+ const titleMap = {
24+ ' /billing/' : ' Billing' ,
25+ ' /command_line_interface/' : ' Command Line Interface' ,
26+ ' /config_file_description/' : ' Config File Description' ,
27+ ' /control_panel_integration/' : ' Control Panel Integration' ,
28+ ' /dashboard/' : ' Dashboard' ,
29+ ' /email/' : ' Email' ,
30+ ' /faq_and_known_issues/' : ' FAQ and Known Issues' ,
31+ ' /features/' : ' Features' ,
32+ ' /ids_integration/' : ' IDS Integration' ,
33+ ' /imunify_patch/' : ' Imunify Patch' ,
34+ ' /imunifyav/' : ' ImunifyAV' ,
35+ ' /installation/' : ' Installation' ,
36+ ' /introduction/' : ' Introduction' ,
37+ ' /localization/' : ' Localization' ,
38+ ' /myimunify/' : ' MyImunify' ,
39+ ' /patchman/' : ' Patchman' ,
40+ ' /terminology/' : ' Terminology' ,
41+ ' /uninstall/' : ' Uninstall' ,
42+ ' /update/' : ' Update' ,
43+ ' /user_interface/' : ' User Interface' ,
44+ ' /whmcs_plugin/' : ' WHMCS Plugin' ,
45+ ' /wordpress_plugin/' : ' WordPress Plugin' ,
46+ };
1347
14- const page = usePageData ()
15- const site = useSiteData ()
16- const { locales: {siteTitle }} = inject (" themeConfig" )
1748const breadCrumbs = computed (() => {
18- const crumbs = [];
19- if (page .value .path !== ' /' ) {
20- crumbs .push ({path: page .value .path , title: page .value .title });
49+ const segments = page .value .path .split (" /" ).filter (Boolean );
50+ const crumbs = [{ path: " /" , title: siteTitle || " Documentation" }];
51+ let cumulativePath = " " ;
52+
53+ for (let i = 0 ; i < segments .length ; i++ ) {
54+ cumulativePath += ` /${ segments[i]} ` ;
55+ const isLast = i === segments .length - 1 ;
56+ const fullPath = cumulativePath .endsWith (" .html" ) ? cumulativePath : ` ${ cumulativePath} /` ;
57+
58+ let title;
59+
60+ if (isLast) {
61+ title = page .value .title ;
62+ } else {
63+ title = titleMap[fullPath] || fullPath;
2164 }
65+
66+ crumbs .push ({ path: fullPath, title });
67+ }
68+
2269 return crumbs;
2370});
2471 </script >
@@ -28,14 +75,23 @@ const breadCrumbs = computed(() => {
2875
2976.breadcrumb
3077 color $breadcrumbColor
78+ text-decoration none
3179
32- & ::after
80+ & :not ( :last-child ) : :after
3381 content " > "
3482 font-family inherit
3583 font-size inherit
84+ color $breadcrumbColor
85+
86+ & :not (:last-child )
87+ cursor pointer
88+
89+ & :hover
90+ color #19 94 f9
3691
3792 & :last-child
3893 cursor default
94+ color $breadcrumbColor
3995
4096.breadcrumb-title
4197 color $breadcrumbColor
0 commit comments