Skip to content

jiangtj-lab/hexo-cake-moon-menu

 
 

Repository files navigation

hexo-cake-moon-menu

This plugin from hexo-theme-inside, thank ike-c.

npm Theme Theme

Want to use in muse/mist see moon-menu-for-muse-mist-example

Preview

image image image image

How to use

yarn add hexo-cake-moon-menu

Config

You can config by moon_menu in hexo theme or data config files.

In hexo or theme:

moon_menu:
  back2top:
    enable: true
  back2bottom:
    enable: true

In moon_menu.yml data file:

back2top:
  enable: true
back2bottom:
  enable: true

You can find more info in default config file.

Custom

It's easy to add new button in moon-menu.

Here's an example about add gitter sidecar.

  1. Add custom head
hexo.extend.filter.register('theme_inject', function(injects) {
  injects.head.file('sidecar', 'views/sidecar.swig', {}, {cache: true});
});
  1. In views/sidecar.swig, create custom function
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
<script>
  ((window.gitter = {}).chat = {}).options = {
    room: 'your-room-name',
    activationElement: false
  };
  // create custom function
  var openGitter = function() {};
  document.addEventListener('gitter-sidecar-ready', function(e) {
    var GitterChat = e.detail.Chat;
    var chat = new GitterChat({
      room: 'your-room-name',
      activationElement: false
    });
    openGitter = () => {
      chat.toggleChat(true);
    }
  });
</script>
  1. Add config
moon_menu:
  chat:
    icon: fa fa-comments
    func: openGitter

Debug

# init this project
yarn install
yarn link
# get example
git clone --recursive git@github.com:jiangtj-lab/hexo-theme-cake-example.git example
cd example
yarn install
# add test link
yarn add hexo-cake-moon-menu
yarn link hexo-cake-moon-menu
# run, see http://localhost:4000
hexo s

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •