How to Add a Newsletter to Your Hexo Blog

This guide explains how to integrate Hakanai Broadcast with your Hexo-powered blog to automatically send newsletters based on your RSS feed.

Prerequisites

  • A Hexo blog
  • A Hakanai account
  • Basic knowledge of npm and Node.js

Setting up RSS Feed in Hexo

Before integrating with Hakanai Broadcast, you need to set up an RSS feed for your blog. We recommend using the hexo-feed plugin for its comprehensive features including support for tags and categories.

1. Install RSS Plugin

npm install hexo-feed --save-dev

2. Configure Plugin

Add the following configuration to your _config.yml:

feed:
  limit: 20
  order_by: "-date"
  tag_dir: "tag"
  category_dir: "category"
  rss:
    enable: true
    template: "themes/theme/layout/_alternate/rss.ejs"
    output: "rss.xml"
  atom:
    enable: true
    template: "themes/theme/layout/_alternate/atom.ejs"
    output: "atom.xml"
  jsonFeed:
    enable: true
    template: "themes/theme/layout/_alternate/json.ejs"
    output: "feed.json"

Add these links to your theme's layout file:

<link rel="alternate" type="application/rss+xml" title="<%= config.title %>" href="<%= full_url_for(`/rss.xml}`) %>">
<link rel="alternate" type="application/atom+xml" title="<%= config.title %>" href="<%= full_url_for(`/atom.xml`) %>">
<link rel="alternate" type="application/json" title="<%= config.title %>" href="<%= full_url_for(`/feed.json`) %>">

Note: You can also use hexo-generator-feed as an alternative plugin if you prefer a simpler setup.

Integrating with Hakanai Broadcast

Once your RSS feed is set up, you can integrate it with Hakanai Broadcast in two steps:

1. Create a Campaign

  1. Navigate to the Campaigns section in your Hakanai dashboard
  2. Create a new RSS-based campaign
  3. Enter your Hexo blog's RSS feed URL (e.g., https://yourblog.com/rss.xml)
  4. Configure your campaign settings

For detailed instructions on campaign creation and management, see our Campaign Management Guide.

2. Add a Subscription Form

To collect subscribers, you'll need to add a subscription form to your blog. Hakanai provides several options:

  • Use our pre-built forms
  • Create a custom form
  • Integrate with your existing forms

For form creation and customization instructions, check our Forms Documentation.

Next Steps

Need Help?

If you encounter any issues or need assistance, feel free to contact our support team.