Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify sidebarender changes and make them more universal #64

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading