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

External urls in the sidebar #764

Closed
hoppities opened this issue Aug 24, 2018 · 6 comments
Closed

External urls in the sidebar #764

hoppities opened this issue Aug 24, 2018 · 6 comments
Labels
topic: theme Relates to VuePress theme type: feature request Request to add a new feature

Comments

@hoppities
Copy link

hoppities commented Aug 24, 2018

Feature request

What problem does this feature solve?

Allows users to put external URLs in the sidebar

What does the proposed API look like?

Not sure

How should this be implemented in your opinion?

I would do it exactly the same as header menu items {text: 'foo', link: 'google.com'}

Are you willing to work on this yourself?**

Yes, point me in the right direction :)

@ldexterldesign
Copy link

Hi,

Are you proposing this for core theme, either way what stops one from doing this with a custom component?

Cheers

@ulivz ulivz added topic: theme Relates to VuePress theme type: feature request Request to add a new feature labels Aug 29, 2018
@MartinMuzatko
Copy link
Contributor

You can use the [] array notation for separating link and name. like so:

['/home/', 'Introduction'],

However, when this does not work with external links.
With this example: ['https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md', 'Contribution Guide'] - you get the following error:

util.js?1d3b:69 [vuepress] No matching page found for sidebar item "/3.x.x/https://github.com/strapi/strapi/blob/master/CONTRIBUTING.md"
resolvePage @ util.js?1d3b:69
vue.runtime.esm.js?a77b:587 [Vue warn]: Error in render: "TypeError: Cannot read property 'match' of undefined"

found in

---> <SidebarGroup> at usr/lib/node_modules/vuepress/lib/default-theme/SidebarGroup.vue
       <Sidebar> at usr/lib/node_modules/vuepress/lib/default-theme/Sidebar.vue
         <Layout> at usr/lib/node_modules/vuepress/lib/default-theme/Layout.vue
           <Root>
warn @ vue.runtime.esm.js?a77b:587
Show 1 more blackboxed frame
vue.runtime.esm.js?a77b:1737 TypeError: Cannot read property 'match' of undefined
    at getHash (util.js?1d3b:13)
    at isActive (util.js?1d3b:47)
    at render (SidebarLink.vue?4f97:10)
    at options.render (index.js?b863:80)
    at createFunctionalComponent (vue.runtime.esm.js?a77b:4056)
    at createComponent (vue.runtime.esm.js?a77b:4246)
    at _createElement (vue.runtime.esm.js?a77b:4416)
    at createElement (vue.runtime.esm.js?a77b:4353)
    at vm._c (vue.runtime.esm.js?a77b:4485)
    at eval (eval at ../../../../../../../../usr/lib/node_modules/vuepress/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"/usr/lib/node_modules/vuepress/node_modules/.cache/vuepress","cacheIdentifier":"18aed22c-vue-loader-template"}!../../../../../../../../usr/lib/node_modules/vuepress/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../../usr/lib/node_modules/vuepress/node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../../../usr/lib/node_modules/vuepress/node_modules/vue-loader/lib/index.js??vue-loader-options!../../../../../../../../usr/lib/node_modules/vuepress/lib/default-theme/SidebarGroup.vue?vue&type=template&id=2bc73b02 (app.js:2185), <anonymous>:44:20)
logError @ vue.runtime.esm.js?a77b:1737
Show 1 more blackboxed frame
vue.runtime.esm.js?a77b:587 [Vue warn]: Invalid prop: type check failed for prop "to". Expected String, Object, got Undefined.

found in

---> <RouterLink>
       <Page> at usr/lib/node_modules/vuepress/lib/default-theme/Page.vue
         <Layout> at usr/lib/node_modules/vuepress/lib/default-theme/Layout.vue
           <Root>
warn @ vue.runtime.esm.js?a77b:587
Show 1 more blackboxed frame
vue.runtime.esm.js?a77b:1737 TypeError: Cannot read property 'name' of undefined
    at normalizeLocation (vue-router.esm.js?855a:1276)
    at VueRouter.resolve (vue-router.esm.js?855a:2574)
    at Proxy.render (vue-router.esm.js?855a:409)
    at VueComponent.Vue._render (vue.runtime.esm.js?a77b:4540)
    at VueComponent.updateComponent (vue.runtime.esm.js?a77b:2784)
    at Watcher.get (vue.runtime.esm.js?a77b:3138)
    at new Watcher (vue.runtime.esm.js?a77b:3127)
    at mountComponent (vue.runtime.esm.js?a77b:2791)
    at VueComponent.Vue.$mount (vue.runtime.esm.js?a77b:7995)
    at init (vue.runtime.esm.js?a77b:4133)

It would be nice to have this in the core!

@MartinMuzatko
Copy link
Contributor

MartinMuzatko commented Sep 18, 2018

Noise? I understand how what looks like a normal question to me, sounds like constant nagging to you. I apologize for that nuisance. I see quite the opposite. I invested the time to document the existing syntax, how this could be integrated with Vuepress and how the exact error looks like, so there is a chance to properly implement this. I am not urging you to develop this off the spot, I rather wanted to know your professional opinion on this subject. With your help I might be able to come up with a PR, so you can focus on the "important thing". Also, I thought it would be nice for the devs of Vue to see where Vuepress is going to be used, so I didn't consider that as noise. I always found projects such as https://madewithvuejs.com/ very inspiring, even though it was not created by the maintainers of the project. So I was eager to share my findings and my contribution in the shape of error logs and what I'm doing and thought I'm contributing. How foolish of me to think that. Besides, I think this is not only important for me? Clearly I'm not the only one interested to see this would be a good addition.

I removed my previous comment and in the future I will only submit PRs instead, to keep the noise down so you can focus on the important things. Thanks for maintaining this project.

@rasapetter
Copy link

This would be really useful for us. Any chance of re-evaluating this suggestion @ulivz ?

@MartinMuzatko
Copy link
Contributor

MartinMuzatko commented Nov 7, 2018

I have done it for strapi.io docs: https://github.com/strapi/strapi/blob/77e73cbc19b8d32767b6764cfa2be506f3c394f7/docs/.vuepress/theme/SidebarLink.vue#L35-L42
I will do a PR once I have time, or you can do a PR now if you want to.

@rasapetter
Copy link

@MartinMuzatko fyi: #1012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: theme Relates to VuePress theme type: feature request Request to add a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants