This plugin from hexo-theme-inside, thank ike-c.
Want to use in muse/mist see moon-menu-for-muse-mist-example
yarn add hexo-cake-moon-menu
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.
It's easy to add new button in moon-menu
.
Here's an example about add gitter sidecar.
- Add custom head
hexo.extend.filter.register('theme_inject', function(injects) {
injects.head.file('sidecar', 'views/sidecar.swig', {}, {cache: true});
});
- 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>
- Add config
moon_menu:
chat:
icon: fa fa-comments
func: openGitter
# 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