Skip to content

Commit

Permalink
simplify sidebarender changes and make them more universal (#64)
Browse files Browse the repository at this point in the history
* simplify sidebarender changes and make them more universal

* simplify sidebarender changes and make them more universal part 2
  • Loading branch information
pirog authored Nov 8, 2024
1 parent 3529e74 commit ef40f15
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 337 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

* Added `getItemNormalizedLink` helper client util
* Added `hasActiveLink` helper client util
* Added `normalize2base` helper client util
* Added `normalizeMVB` helper client util
* Added `normalizeRoot` helper client util
* Added `version` alias information to config
* Added `VPLSidebarEnder` component to better handle `mvb` things
* Fixed bug preventing user specified `buildEnd` and `transformPageData` from running after theme's
* Fixed bug preventing `mvb` from correctly setting the `mvbase`
* Improved `mvb` and `root` link normalization
Expand Down
15 changes: 5 additions & 10 deletions client/get-item-nl.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import {useData} from 'vitepress';
import {default as normalize} from './normalize-2base.js';
import {default as normalizeMvb} from './normalize-mvblink.js';
import {default as normalizeRoot} from './normalize-rootlink.js';

export default function getItemNormalizedLink(item) {
// if we dont have what we need just return that garbage
if (!item.link) return item.link;

const {site} = useData();
const base = site?.value?.base ?? '/';

// handle special rels
if (item.rel === 'mvb') return normalizeMvb(item.link);
else if (item.rel === 'root') return normalizeRoot(item.link);
// if this is not a special mvb then just return
if (item.rel !== 'mvb') return item.link;

// and this is everythign else
return normalize(item.link, base);
// otherwise normalize on version base
const {site} = useData();
return normalize(item.link, site?.value?.themeConfig?.multiVersionBuild?.base ?? '/');
};
15 changes: 0 additions & 15 deletions client/has-active-link.js

This file was deleted.

7 changes: 5 additions & 2 deletions components/VPLLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
v-if="sidebarEnder !== false"
class="sidebar-end"
>
<SidebarEnder :item="sidebarEnder" />
<VPSideBarItem
:depth="0"
:item="sidebarEnder"
/>
</div>
</template>

Expand Down Expand Up @@ -55,12 +58,12 @@ import {useData} from 'vitepress';
import {computed, ref, watch} from 'vue';
import DefaultTheme from 'vitepress/theme';
import VPSideBarItem from 'vitepress/dist/client/theme-default/components/VPSidebarItem.vue';
import Alert from './VPLAlert.vue';
import CollectionHeader from './VPLCollectionHeader.vue';
import MailChimp from './VPLMailChimp.vue';
import PostHeader from './VPLPostHeader.vue';
import SidebarEnder from './VPLSidebarEnder.vue';
import Tags from './VPLCollectionItemTags.vue';
const {Layout} = DefaultTheme;
Expand Down
304 changes: 0 additions & 304 deletions components/VPLSidebarEnder.vue

This file was deleted.

Loading

0 comments on commit ef40f15

Please sign in to comment.