1.0.2 ā€¢ Published 2 years ago

hexo-plugin-schnack v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Plugin for adding the Schnack comment system to your Hexo Blog.

šŸ  Homepage

āœØ Demo

Installation

  1. Enter your blog folder and install the plugin: yarn add hexo-plugin-schnack

  2. Add <div class="schnack"></div> in the location you want your comments to show in theme/<your theme>/layout/_partials/article.js (usually will be under article-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.

  3. Add the schnack, create-schnack, and jst libraries: yarn add schnack create-schnack jst

  4. Create a basic schnack.json config file using the create-schnack helper library, making sure you say y 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.

  1. Configure the rest following the configuration guide. You may want to set your comments.db and session.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 of https 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 the ssl configuration option.
  1. Test your config: yarn exec schnack start. If all goes well, it shouldn't crash or error out.

  2. 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

  1. 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.

  1. Add yarn exec schnack start to your package.json:
"scripts": {
    ...
    "chat": "yarn exec schnack start"
    ...
}
  1. Start schnack and monitor it with pm2: pm2 start --name "<blog name> Schnack" 'yarn chat' && pm2 monit

  2. 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.

  3. 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

šŸ¤ 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

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago