rel

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: 0 Imported by: 1

Documentation

Overview

Package rel defines the Rel type and its predefined values.

Link relationship between current document and linked resource. Defines semantic meaning and helps browsers optimize resource loading, security, and user experience.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stylesheet CSS stylesheet resource for styling the document. Browser will load and apply CSS
	// rules to the current page for visual presentation and layout.
	Stylesheet = Rel("stylesheet")

	// Icon Icon resource representing the document or site. Displayed in browser tabs, bookmarks,
	// and application interfaces. Supports various image formats and sizes.
	Icon = Rel("icon")

	// Preload High-priority resource to load early in page lifecycle. Browser fetches resource
	// immediately for later use. Requires 'as' attribute for resource type specification.
	Preload = Rel("preload")

	// Prefetch Low-priority resource likely to be needed in future navigation. Browser may fetch
	// resource during idle time for performance optimization of subsequent pages.
	Prefetch = Rel("prefetch")

	// DnsPrefetch Resolve DNS for external domain before resource is actually needed. Reduces connection
	// latency for future requests to the specified domain.
	DnsPrefetch = Rel("dns-prefetch")

	// Preconnect Establish early connection to external origin including DNS, TCP, and TLS negotiation.
	// Optimizes performance for resources from third-party domains.
	Preconnect = Rel("preconnect")

	// Canonical Preferred URL for current content to prevent duplicate content issues. Tells search
	// engines which URL to index when multiple URLs have similar content.
	Canonical = Rel("canonical")

	// Alternate Alternative representation of current document. May specify different language, format,
	// or media type version of the same content for accessibility and internationalization.
	Alternate = Rel("alternate")

	// Prev Previous document in a sequence or series. Helps users and search engines understand
	// document relationships and navigate through sequential content.
	Prev = Rel("prev")

	// Next Next document in a sequence or series. Enables prefetching and provides navigation
	// hints for sequential content like articles or pagination.
	Next = Rel("next")

	// Help Help documentation or support resource related to current document. Provides contextual
	// assistance and user guidance for the current page or application.
	Help = Rel("help")

	// License Copyright license covering current document content. Legal information about content
	// usage rights and redistribution terms for the document.
	License = Rel("license")

	// Manifest Web app manifest file containing metadata about the application. Enables progressive
	// web app features like installation and offline capabilities.
	Manifest = Rel("manifest")

	// ModulePreload JavaScript module to preload for improved performance. Browser fetches and compiles
	// ES modules early in the page lifecycle for faster execution.
	ModulePreload = Rel("modulepreload")

	// Author Link to the author of the current document or article. Helps search engines
	// and readers identify who created the content.
	Author = Rel("author")

	// Bookmark Permanent link (permalink) for the nearest ancestor section. Provides a stable
	// URL for bookmarking or referencing a specific section of content.
	Bookmark = Rel("bookmark")

	// Expect Render-blocking hint indicating the linked element is expected in the document.
	// Browser delays rendering until the expected element is parsed.
	Expect = Rel("expect")

	// External Indicates the link points to an external site not part of the current domain.
	// Helps search engines understand site boundaries and link relationships.
	External = Rel("external")

	// Me Indicates the linked resource represents the person who owns the current document.
	// Used for identity verification and IndieWeb authentication patterns.
	Me = Rel("me")

	// NoFollow Indicates the link is not endorsed by the author. Tells search engines not to
	// pass ranking credit through the link. Common for user-generated content.
	NoFollow = Rel("nofollow")

	// NoOpener Prevents the opened page from accessing window.opener. Security measure for links
	// opening new tabs to prevent reverse tabnapping attacks.
	NoOpener = Rel("noopener")

	// NoReferrer No Referer header sent when following the link. Provides privacy by hiding the
	// source page URL from the destination. Implies noopener behaviour.
	NoReferrer = Rel("noreferrer")

	// Opener Allows the opened page to access window.opener. Reverses the default noopener
	// behaviour for cross-origin links that need a browsing context reference.
	Opener = Rel("opener")

	// PrivacyPolicy Link to the privacy policy governing data collection on the current page.
	// Helps users and automated tools locate privacy documentation.
	PrivacyPolicy = Rel("privacy-policy")

	// Search Link to a search interface for the current site or related resources.
	// Enables browsers and tools to discover the site's search functionality.
	Search = Rel("search")

	// Tag Indicates the linked resource is a tag or keyword describing the current document.
	// Used for content categorisation and topic tagging.
	Tag = Rel("tag")

	// TermsOfService Link to the terms of service governing use of the current page or site.
	// Helps users and automated tools locate legal documentation.
	TermsOfService = Rel("terms-of-service")

	// AppleTouchIcon Apple-specific icon for iOS devices. Used when users add website to home screen
	// or bookmark on Apple devices. Supports various sizes and resolutions.
	AppleTouchIcon = Rel("apple-touch-icon")
)

Variables for Rel values

Functions

This section is empty.

Types

type Rel

type Rel []byte

Rel is a typed value for the HTML rel attribute.

Link relationship between current document and linked resource. Defines semantic meaning and helps browsers optimize resource loading, security, and user experience.

func Custom

func Custom(value string) Rel

Custom allows setting a custom Rel value for edge cases or future specifications. Use this when the predefined constants don't cover your specific use case.

Jump to

Keyboard shortcuts

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