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

How to specify pages #10

Closed
fanux opened this issue Dec 4, 2019 · 10 comments
Closed

How to specify pages #10

fanux opened this issue Dec 4, 2019 · 10 comments

Comments

@fanux
Copy link

fanux commented Dec 4, 2019

I only want my blog pages auto-generate, but all other pages generate sidebar too, and I can't remove the root dir.

image

@ozum
Copy link
Owner

ozum commented Dec 4, 2019

Could you provide a sample repo please?

@fanux
Copy link
Author

fanux commented Dec 5, 2019

https://github.com/sealyun/vuepress/blob/40ee4fb15d31bb8240a8bd6db39e220a8729a4db/.vuepress/config.js

plugins: [
['autobar', {setHomepage : 'hide',navPrefix : "blog"}]

@fanux
Copy link
Author

fanux commented Dec 5, 2019

const getConfig = require("vuepress-bar");
const barConfig = getConfig('./')

module.exports = {
  head: [
    ['meta', { name: 'theme-color', content: '#007af5' }],
    ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
    ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black' }],
    ['script', {}, `
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?2803648cc5852dd3e9e46bbd0bf63366";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
  `]
  ],
  title: 'sealyun | kubernetes安装',
  themeConfig: {
    logo: 'https://sealyun.com/img/logo.png',
    sidebar: barConfig.sidebar,
    nav: [
      { text: '离线包下载', link: 'http://store.lameleg.com', target:'_self', rel:'' },
      { text: '常见问题', link: '/faq/', target:'_self', rel:'' },
      { text: '版本变更', link: '/changelog/', target:'_self', rel:'' },
      { text: '开源项目', link: '/github/', target:'_self' },
      { text: '联系方式', link: '/contact/', target:'_self' },
      {
        text: '友情连接',
        items: [
          { text: '', items: [{link: 'https://fuckcloudnative.io/#sealyun', text: "云原生实验室"}] },
          { text: '', items: [{link: 'https://kuboard.cn/#sealyun', text: "kuboard"}] },
          { text: '', items: [{link: 'https://www.qikqiak.com/?utm_source=sealyun.com', text: "阳明的博客"}] },
          { text: '', items: [{link: 'https://zhangguanzhang.github.io/#sealyun', text: "张馆长的博客"}] },
        ]
      },
    ]
  },
}

@fanux
Copy link
Author

fanux commented Dec 5, 2019

const barConfig = getConfig("./",["/blog/","/docs/"])

I think add a pages list will better

@ozum
Copy link
Owner

ozum commented Dec 5, 2019

You should add all your content to a subfolder for vuepress-bar working correctly.

For example:

Add all your content to docs (including .vuepress) folder as below:

image

Then in config.js

const getConfig = require("vuepress-bar");
const barConfig = getConfig(`${__dirname}/..`);



module.exports = {
  // ... your config 
  themeConfig: {
    sidebar: barConfig.sidebar,
    nav: [] // your nav details
  }
}

@ozum ozum closed this as completed Dec 5, 2019
@fanux
Copy link
Author

fanux commented Dec 5, 2019

So dir like this?

website
     |--.vuepress
     |--docs
             |--.vuepress
     |--README.md

Two .vuepress dir?

@ozum
Copy link
Owner

ozum commented Dec 5, 2019

No, just single .vuepress.

Only in /docs/.vuepress:

website
  |--docs
    |--.vuepress
    |--README.md

@fanux
Copy link
Author

fanux commented Dec 6, 2019

But I have other pages... this is my website: sealyun.com, and I don't expect other pages have sidebar

@ozum
Copy link
Owner

ozum commented Dec 6, 2019

Maybe you can create two vuepress sites and add manual links between them in nav:

website
  |--docs1
    |--.vuepress
    |--README.md
  |--docs2
    |--.vuepress
    |--README.md

@fanux
Copy link
Author

fanux commented Dec 7, 2019

I think that is not very nice, vuepress bar add a config to filter out which pages need it will better. Like this :

const barConfig = getConfig("./",["/blog/","/docs/"])

It is my suggestion 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants