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

Global Footer in Default Theme #339

Closed
raytu opened this issue May 4, 2018 · 6 comments
Closed

Global Footer in Default Theme #339

raytu opened this issue May 4, 2018 · 6 comments

Comments

@raytu
Copy link

raytu commented May 4, 2018

It seems that footers are defined separately in each README.md front matter. Is there a way to define a global footer for all pages from a single file or themeConfig?

@meteorlxy
Copy link
Member

meteorlxy commented May 4, 2018

Not yet in default theme.

In fact, in current default theme, only the home layout has a footer.

There is a <slot name="page-bottom" slot="bottom"/> for page layout to put something like a footer (current some ads for vuejs official theme, lol)

You can check the vuepress-theme-vue in your node_modules/ to find how to implement it.

Example:

// .vuepress/theme/Layout.vue
<template>
  <Layout>
    <footer slot="page-bottom">
      My page footer
    </footer>
  </Layout>
</template>

<script>
import Layout from '@default-theme/Layout.vue'

export default {
  components: {
    Layout,
  }
}
</script>

@ghys
Copy link
Contributor

ghys commented May 4, 2018

I have the same requirement, I tried creating a new .vuepress/theme/Layout.vue reusing the layout component from the default theme as shown above.

The problem is, my override.styl is not taken into account anymore (I override $accentColor etc.), presumably because of this:

const hasUserOverride = options.useDefaultTheme && fs.existsSync(overridePath)

(useDefaultTheme is now false)

Would it make sense to always copy override.styl if found, to allow custom themes based on the default theme to still override stylus variables?

@ulivz
Copy link
Member

ulivz commented May 10, 2018

As @meteorlxy said, it shouldn't be included in default theme.

@ghys You should open another issue for feature request of override.styl in custom theme.

@iamchathu
Copy link

The solution is not works with current version.

@imaegoo
Copy link

imaegoo commented Sep 15, 2020

The solution is not works with current version.

New solution for vuepress v1.5.4 -- v1.x

Create 2 files

  1. .vuepress/theme/index.js
module.exports = {
  extend: '@vuepress/theme-default'
}
  1. .vuepress/theme/layouts/Layout.vue
<template>
  <ParentLayout>
    <template #page-bottom>
      <div>My custom footer</div>
    </template>
  </ParentLayout>
</template>

<script>
import ParentLayout from '@parent-theme/layouts/Layout.vue'

export default {
  name: 'Layout',

  components: {
    ParentLayout
  }
}
</script>

New solution for vuepress v2.0.0-beta.45

https://v2.vuepress.vuejs.org/reference/default-theme/extending.html

@JenuelDev
Copy link

Changing the footer ignores some of my plugin like the vuepress-theme-succinct.

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

7 participants