Astral.Route (Astral v0.1.8)

Copy Markdown View Source

A generated output route.

Routes are produced by plugins for files that are not ordinary pages, such as feeds, sitemaps, tag indexes, and pagination pages.

Summary

Functions

Return true when a request path matches a route path with or without a trailing slash.

Build a generated route and resolve its output path under the site outdir.

Normalize a route path for matching.

Return the output-relative path for a route.

Resolve a route's output path under the site outdir when it is not set.

Types

t()

@type t() :: %Astral.Route{
  assigns: map(),
  content_type: String.t(),
  kind: atom() | nil,
  metadata: map(),
  output_path: String.t() | nil,
  path: String.t()
}

Functions

match?(route_path, request_path)

@spec match?(String.t(), String.t()) :: boolean()

Return true when a request path matches a route path with or without a trailing slash.

new(path, config, opts \\ [])

@spec new(String.t(), Astral.Config.t(), keyword()) :: t()

Build a generated route and resolve its output path under the site outdir.

normalize(path)

@spec normalize(String.t()) :: String.t()

Normalize a route path for matching.

output_relative(route_path)

@spec output_relative(String.t()) :: String.t()

Return the output-relative path for a route.

with_output_path(route, config)

@spec with_output_path(t(), Astral.Config.t()) :: t()

Resolve a route's output path under the site outdir when it is not set.