generic.hugo.best-practice.invalid-base-url.invalid-base-url

profile photo of semgrepsemgrep
Author
161
Download Count*

The 'baseURL' is invalid. This may cause links to not work if deployed. Include the scheme (e.g., http:// or https://).

Run Locally

Run in CI

Defintion

rules:
  - id: invalid-base-url
    patterns:
      - pattern: baseURL = "..."
      - pattern-not-regex: (.*http).*
    severity: WARNING
    message: The 'baseURL' is invalid. This may cause links to not work if deployed.
      Include the scheme (e.g., http:// or https://).
    languages:
      - generic
    metadata:
      references:
        - https://gohugo.io/
      category: best-practice
      technology:
        - hugo
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

invalid-base-url.toml

# ruleid: invalid-base-url
baseURL = "example.com"
languageCode = "en-us"
title = "Example"
theme = "ananke"
uglyurls = true

MetaDataFormat = "yaml"
DefaultContentLanguage = "en"
Paginate = 10
enableRobotsTXT = true

[menu]
[[menu.main]]
identifer = "about"
name = "About"
url = "/about.html"
weight = -110

# ok: invalid-base-url
baseURL = "http://example.com"

# ok: invalid-base-url
baseURL = "https://example.com"