HandyOrg/HandyControl · warning
URL can NOT be empty
Error message
URL can NOT be empty
What it means
The Hexo theme's button tag helper (postButton) logs a warning when the first argument (URL) is missing or empty. It is not a thrown exception — hexo.log.warn prints 'URL can NOT be empty' during site generation and the tag renders with an empty/undefined URL attribute.
Solutions
- Provide the URL as the first argument: {% button https://example.com, Text %}.
- Search posts (grep -rn '{% button' source/) to find tags missing the URL argument.
- Optionally patch button.js to throw or render nothing instead of only warning.
- Rebuild the site and confirm the warning disappears.
Example fix
// before (markdown)
{% button , Click here %}
// after
{% button https://example.com, Click here %} Defensive patterns
Strategy: validation
Validate before calling
// Hexo template/lint check before generation
// scripts/check-tags.js
const re = /{%\s*button\s*,?\s*[,}]/; // button tag with empty first arg
if (re.test(content)) console.warn('button tag missing URL:', path); Try / catch
// not applicable — the tag only logs a warning; fix the post content instead
// optional: patch button.js to fail the build
if (!url) { hexo.log.warn('URL can NOT be empty'); throw new Error('button tag requires a URL'); } Prevention
- Always pass the URL as the first button tag argument.
- Add a CI lint script that scans posts for button tags with empty arguments.
- Copy theme tag examples completely — argument order is url, text, icon, title.
When it happens
Trigger: Using the {% button %} (postButton) tag in a Markdown post without the URL argument: e.g. {% button %} or {% button , Click %}.
Common situations: Theme documentation examples copied incompletely, markdown lint/editors stripping arguments, or posts migrated from other themes using different tag syntax.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Label text must be defined!
- Tabs block must have unique name!
- WARNING: `exturl` and `extlink` tag will not longer be…
- Image src can NOT be empty
- Include file empty.
AI-assisted analysis of HandyOrg/HandyControl@2c0875ebd6 (2026-09-14).
Data as JSON: /api/errors/f01e47a5f6fb5d31.
Report an issue: GitHub.
Appendix: source
Thrown at doc/themes/next/scripts/tags/button.js:17
/**
* button.js | https://theme-next.org/docs/tag-plugins/button
*/
/* global hexo */
'use strict';
function postButton(args) {
args = args.join(' ').split(',');
var url = args[0];
var text = args[1] || '';
var icon = args[2] || '';
var title = args[3] || '';
if (!url) {
hexo.log.warn('URL can NOT be empty');
}
text = text.trim();
icon = icon.trim();
title = title.trim();
var result = [`<a class="btn" href="${url}"`];
title.length > 0 && result.push(` title="${title}"`);
result.push('>');
icon.length > 0 && result.push(`<i class="fa fa-${icon}"></i>`);
text.length > 0 && result.push(text);
result.push('</a>');
return result.join('');
}
hexo.extend.tag.register('button', postButton, {ends: false});
hexo.extend.tag.register('btn', postButton, {ends: false});View on GitHub (pinned to 2c0875ebd6)