hexo-plugin-schnack
v1.0.2
Published
Plugin for adding the Schnack comment system to your Hexo Blog.
Downloads
2
Maintainers
Readme
Plugin for adding the Schnack comment system to your Hexo Blog.
🏠 Homepage
✨ Demo
Installation
Enter your blog folder and install the plugin:
yarn add hexo-plugin-schnack
Add
<div class="schnack"></div>
in the location you want your comments to show intheme/<your theme>/layout/_partials/article.js
(usually will be underarticle-footer
if you want comments to show under your posts). I would recommend wrapping it with<% if (config.schnack.enable){ %>
and<% } %>
so that you can easily disable in the future if needed.Add the schnack, create-schnack, and jst libraries:
yarn add schnack create-schnack jst
Create a basic
schnack.json
config file using the create-schnack helper library, making sure you sayy
to the first question and answering each question to the best of your ability:yarn exec create-schnack
Important
When you arrive at the plugins question, there is a bug where all plugins are checkmarked but won't install or configure correctly. Use the arrow keys to select the ones you wanna install and then hit the spacebar to select. You can always manually add more later but at least one OAUTH and notification one are required. All plugins are named @schnack/plugin-<plugin name>
. See guide in next step for more info.
- Configure the rest following the configuration guide. You may want to set your
comments.db
andsession.db
files to a directory outside of your blog folder if you're using version control or add them to a.gitignore
file. They will constantly be updating as your blog grows and you may not want to version control them.
Important
page_url
needs to be<your blog url>/%SLUG%
- If you're running your site through a reverse proxy such as CloudFlare, you may have to use
http
instead ofhttps
for your urls. A possible workaround is downloading both your certificate and key files to a directory on the server that's outside of your blog folder and then telling schnack where to find them using thessl
configuration option.
Test your config:
yarn exec schnack start
. If all goes well, it shouldn't crash or error out.Enable and configure schnack in your
_config.yml
file:
schnack:
enable: true
host: <full url of your Schnack instance>
Advanced configuration options:
schnack:
slug: <probably won't need to change this>
partials: <these are all strings and change what language/text is shown for every aspect of the web client; most should be self-explanatory>
preview:
edit:
sendComment:
cancel:
or: <not sure what this is for>
mute:
unmute:
postComment:
adminApproval: <if moderation is on, this is what is shown to you when a new comment appears>
waitingForApproval: <same thing but for your readers>
signInVia: <readers must be authenticated through any service you set up and will get this warning message>
reply:
loginStatus:
If you ever want to use the defaults or start over, just remove or comment out anything under partials.
Optional but Recommended Steps
- Globally install the pm2 process manager and pm2-logrotate so you can monitor, run and keep local logs of schnack quickly and easily:
yarn global add pm2 pm2-logrotate
. Lograte's defaults are pretty sane but if you need to further tweak them, check here.
All logs can be found under ~/.pm2/logs
and they are named well enough that you should be able to figure them out if you run into issues.
- Add
yarn exec schnack start
to yourpackage.json
:
"scripts": {
...
"chat": "yarn exec schnack start"
...
}
Start schnack and monitor it with pm2:
pm2 start --name "<blog name> Schnack" 'yarn chat' && pm2 monit
If everything's working as intended, the logs shouldn't show any errors and the process should show that it's using memory. Hit
Q
to exit.Add pm2 to system startup:
pm2 save && pm2 startup
. It should print out a message telling you to use a command to add pm2 to your init system. Run it and you should be good to go.
Author
👤 Brandon D
- Github: @bedwardly-down
🤝 Contributing
Contributions, issues, feature requests and feedback are welcome!Feel free to check issues page for plugin related ones or schnack for the rest.
Show your support
Give a ⭐️ if this project helped you!u!
📝 License
Copyright © 2022 Brandon D . This project is MIT licensed.
This README was generated with ❤️ by readme-md-generator