Skip to content

Commit

Permalink
fix: avoid broken icons on indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
elevatebart committed Feb 12, 2025
1 parent a277740 commit c22b4b6
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions components/content/ChildCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="card">
<div class="card-body d-flex">
<span class="card-icon">
<img :src="item.icon" :alt="item.title" width="50px" height="50px"/>
<img :src="item.icon ?? currentPage.icon" :alt="item.title" width="50px" height="50px"/>
</span>
<div>
<h4 class="card-title">{{ item.title }}</h4>
Expand All @@ -30,20 +30,25 @@
const route = useRoute()
let currentPage = null;
let currentPageSlug = null;
if (props.pageUrl) {
currentPage = props.pageUrl;
currentPageSlug = props.pageUrl;
} else {
currentPage = route.path;
currentPageSlug = route.path;
}
currentPage = currentPage.endsWith("/") ? currentPage.slice(0, -1) : currentPage;
const currentPageDir = currentPage.split('/').pop();
currentPageSlug = currentPageSlug.endsWith("/") ? currentPageSlug.slice(0, -1) : currentPageSlug;
const currentPageDir = currentPageSlug.split('/').pop();
const {data: navigation} = await useAsyncData(
`ChildCard-${hash(currentPage)}`,
() => queryContent(currentPage + "/").where({ _dir: currentPageDir}).find()
`ChildCard-${hash(currentPageSlug)}`,
() => queryContent(currentPageSlug + "/").where({ _dir: currentPageDir}).find()
);
const {data: currentPage} = await useAsyncData(
`ChildCardCurrentPage-${hash(currentPageSlug)}`,
() => queryContent(currentPageSlug).findOne()
);
// if (currentPage == "/docs/faq") {
Expand Down

0 comments on commit c22b4b6

Please sign in to comment.