{"record":{"id":"f01e47a5f6fb5d31","repo":"HandyOrg/HandyControl","slug":"url-can-not-be-empty","errorCode":null,"errorMessage":"URL can NOT be empty","messagePattern":"URL can NOT be empty","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"doc/themes/next/scripts/tags/button.js","lineNumber":17,"sourceCode":"/**\n * button.js | https://theme-next.org/docs/tag-plugins/button\n */\n\n/* global hexo */\n\n'use strict';\n\nfunction postButton(args) {\n  args = args.join(' ').split(',');\n  var url   = args[0];\n  var text  = args[1] || '';\n  var icon  = args[2] || '';\n  var title = args[3] || '';\n\n  if (!url) {\n    hexo.log.warn('URL can NOT be empty');\n  }\n\n  text = text.trim();\n  icon = icon.trim();\n  title = title.trim();\n\n  var result = [`<a class=\"btn\" href=\"${url}\"`];\n  title.length > 0 && result.push(` title=\"${title}\"`);\n  result.push('>');\n  icon.length > 0 && result.push(`<i class=\"fa fa-${icon}\"></i>`);\n  text.length > 0 && result.push(text);\n  result.push('</a>');\n\n  return result.join('');\n}\n\nhexo.extend.tag.register('button', postButton, {ends: false});\nhexo.extend.tag.register('btn', postButton, {ends: false});","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/HandyOrg/HandyControl/blob/2c0875ebd67326e0c67282967e3e809c69282fee/doc/themes/next/scripts/tags/button.js#L1-L35","documentation":"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.","triggerScenarios":"Using the {% button %} (postButton) tag in a Markdown post without the URL argument: e.g. {% button %} or {% button , Click %}.","commonSituations":"Theme documentation examples copied incompletely, markdown lint/editors stripping arguments, or posts migrated from other themes using different tag syntax.","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."],"exampleFix":"// before (markdown)\n{% button , Click here %}\n// after\n{% button https://example.com, Click here %}","handlingStrategy":"validation","validationCode":"// Hexo template/lint check before generation\n// scripts/check-tags.js\nconst re = /{%\\s*button\\s*,?\\s*[,}]/; // button tag with empty first arg\nif (re.test(content)) console.warn('button tag missing URL:', path);","typeGuard":null,"tryCatchPattern":"// not applicable — the tag only logs a warning; fix the post content instead\n// optional: patch button.js to fail the build\nif (!url) { hexo.log.warn('URL can NOT be empty'); throw new Error('button tag requires a URL'); }","preventionTips":["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."],"tags":["hexo","theme","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"2c0875ebd67326e0c67282967e3e809c69282fee","analyzedAt":"2026-09-14T14:45:29.754Z","contentChangedAt":"2026-09-14T14:45:29.754Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}