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

profile photo of semgrepsemgrep
Author
225
Download Count*

The 'baseURL' is set to localhost. This may cause links to not work if deployed.

Run Locally

Run in CI

Defintion

rules:
  - id: localhost-base-url
    patterns:
      - pattern: baseURL = "..."
      - pattern-regex: .*(localhost|127\.0\.0\.1).*
    severity: WARNING
    message: The 'baseURL' is set to localhost. This may cause links to not work if
      deployed.
    languages:
      - generic
    metadata:
      references:
        - https://gohugo.io/
      category: best-practice
      technology:
        - hugo
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

localhost-base-url.toml

# ruleid: localhost-base-url
baseURL = "http://localhost:1313/"
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