gohugoio/hugo · error

URLs with protocol (http*) not supported

Error message

URLs with protocol (http*) not supported: %q. In page %q

What it means

Front-matter validation in the `url` case (page__meta.go:722). Hugo lets you override a page's output URL via the `url` front-matter key, but only with a path-relative value; an absolute http(s):// URL is rejected because it would break permalink/permalink resolution and is almost always a user mistake.

Solutions

  1. Use a path-relative URL: `url: /foo/` or `url: /foo/index.html`.
  2. For redirects use the `aliases` field (also path-relative) or a redirect plugin.
  3. Remove the scheme/host from the url value entirely.

Example fix

// before
---
url: https://example.com/foo/
---

// after
---
url: /foo/
---
Defensive patterns

Strategy: validation

Validate before calling

# reject absolute http(s) url front matter
url='https://example.com/'
case "$url" in http://*|https://*) echo "use a path-relative url";; esac

Prevention

When it happens

Trigger: Setting `url: https://example.com/foo/` (or http://) in a page's front matter. The check triggers on the 'http://' or 'https://' prefix before assignment.

Common situations: Pasting a full external link into `url` thinking it sets a redirect; migrating from another SSG that allowed absolute URLs in its equivalent field.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/4b7e4842e585a587. Report an issue: GitHub.

Appendix: source

Thrown at hugolib/page__meta.go:722

			pcfg.Title = cast.ToString(v)
			pcfg.Params[loki] = pcfg.Title
		case "linktitle":
			pcfg.LinkTitle = cast.ToString(v)
			pcfg.Params[loki] = pcfg.LinkTitle
		case "summary":
			pcfg.Summary = cast.ToString(v)
			pcfg.Params[loki] = pcfg.Summary
		case "description":
			pcfg.Description = cast.ToString(v)
			pcfg.Params[loki] = pcfg.Description
		case "slug":
			// Don't start or end with a -
			pcfg.Slug = strings.Trim(cast.ToString(v), "-")
			pcfg.Params[loki] = pm.Slug()
		case "url":
			url := cast.ToString(v)
			if strings.HasPrefix(url, "http://") || strings.HasPrefix(url, "https://") {
				return fmt.Errorf("URLs with protocol (http*) not supported: %q. In page %q", url, ps.pathOrTitle())
			}
			pcfg.URL = url
			pcfg.Params[loki] = url
		case "type":
			pcfg.Type = cast.ToString(v)
			pcfg.Params[loki] = pcfg.Type
		case "keywords":
			pcfg.Keywords = cast.ToStringSlice(v)
			pcfg.Params[loki] = pcfg.Keywords
		case "headless":
			// Legacy setting for leaf bundles.
			// This is since Hugo 0.63 handled in a more general way for all
			// pages.
			isHeadless := cast.ToBool(v)
			pcfg.Params[loki] = isHeadless
			if isHeadless {
				pm.pageConfig.Build.List = pagemeta.Never
				pm.pageConfig.Build.Render = pagemeta.Never

View on GitHub (pinned to 52c9bd7908)