base

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package base provides constructors and methods for the HTML <base> element.

The <base> HTML element specifies the base URL to use for all relative URLs in a document and the default target browsing context for links. Only one <base> element is permitted per document, and it should appear in the <head> before any elements with URLs. Useful for single-page applications, documentation sites, and pages served from different paths than their assets.

Index

Constants

This section is empty.

Variables

View Source
var (
	TagOpen = []byte("<base")

	AttrHref   = []byte(" href=\"")
	AttrTarget = []byte(" target=\"")
)

Byte constants for HTML rendering.

Functions

func New

func New() *element

New creates a new base element without any initial attributes. Example: base.New().Href("/docs/") Renders: <base href="/docs/" />

func URL

func URL(href string) *element

URL creates a base element with the specified base URL. Example: base.URL("/docs/") Renders: <base href="/docs/" />

Types

type Element

type Element = element

Element is an exported alias for the private element type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL