webls/sitemap

Types

The fequency at which a page tends to change

pub type ChangeFrequency {
  Always
  Hourly
  Daily
  Weekly
  Monthly
  Yearly
  Never
}

Constructors

  • Always
  • Hourly
  • Daily
  • Weekly
  • Monthly
  • Yearly
  • Never

A complete sitemap

pub type Sitemap {
  Sitemap(
    url: String,
    last_modified: Option(Time),
    items: List(SitemapItem),
  )
}

Constructors

  • Sitemap(
      url: String,
      last_modified: Option(Time),
      items: List(SitemapItem),
    )

    Arguments

    • url

      The url location of the sitemap

    • last_modified

      The time of last modification of the sitemap

    • items

      The list of items contained within the sitemap

A item within a sitemap

pub type SitemapItem {
  SitemapItem(
    loc: String,
    last_modified: Option(Time),
    change_frequency: Option(ChangeFrequency),
    priority: Option(Float),
  )
}

Constructors

  • SitemapItem(
      loc: String,
      last_modified: Option(Time),
      change_frequency: Option(ChangeFrequency),
      priority: Option(Float),
    )

    Arguments

    • loc

      The location/url of the page

    • last_modified

      The time of last modification of the page

    • change_frequency

      How frequently the page is likely to continue to change

    • priority

      The priority of the page compared to others within the sitemap Must be between 0.0 and 1.0

Functions

pub fn item(loc: String) -> SitemapItem

Create a base sitemap item with just the URL location

pub fn sitemap(url: String) -> Sitemap

Create a sitemap with a url

pub fn to_string(sitemap: Sitemap) -> String

Generates a sitemap.xml string from a sitemap

pub fn with_item_frequency(
  item: SitemapItem,
  frequency: ChangeFrequency,
) -> SitemapItem

Add a change frequency to the sitemap item

pub fn with_item_last_modified(
  item: SitemapItem,
  modified: Time,
) -> SitemapItem

Add a last modified time to the sitemap item

pub fn with_item_priority(
  item: SitemapItem,
  priority: Float,
) -> SitemapItem

Add a priority to the sitemap item

pub fn with_sitemap_item(
  sitemap: Sitemap,
  item: SitemapItem,
) -> Sitemap

Adds a sitemap item to the sitemap

pub fn with_sitemap_items(
  sitemap: Sitemap,
  items: List(SitemapItem),
) -> Sitemap

Adds a list of sitemap items to the sitemap

pub fn with_sitemap_last_modified(
  sitemap: Sitemap,
  last_modified: Time,
) -> Sitemap

Add a last modified time to the sitemap

Search Document