sitemap

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package sitemap generates an list of pages of the website. The generated XML file is stored on the site's root and can be parsed by search engine bots.

Index

Constants

View Source
const (
	// Base URL of the website.
	Base = "https://defacto2.net"
	// Local base URL for the websote hosted on a Docker container.
	LocalBase = "http://localhost:8560"
	// limit the number of urls as permitted by Bing and Google search engines.
	Limit = 50000
)
View Source
const (
	// TitleSuffix is the string normally appended to most browser tabs.
	TitleSuffix = " | Defacto2"
)

Variables

View Source
var ErrNoIDs = errors.New("no ids to randomise")

Functions

func AbsPaths added in v1.10.0

func AbsPaths(base string) ([28]string, error)

AbsPaths returns all the static URLs used by the sitemap.

func AbsPathsH3 added in v1.10.0

func AbsPathsH3(base string) ([]string, error)

AbsPaths returns all the HTML3 static URLs used by the sitemap.

func Color404 added in v1.10.0

func Color404(i int) string

Color404 applies a success checkmark and color when i matches status code 404.

func ColorCode added in v1.10.0

func ColorCode(i int) string

ColorCode applies a success checkmark and color when i matches status code 200.

func Create

func Create() error

Create generates and prints the sitemap.

func FileList added in v1.10.0

func FileList(base string) ([]string, error)

FileList returns a complete list of URL query strings for the file lists.

func FindTitle added in v1.10.0

func FindTitle(b []byte) string

FindTitle returns the string value of the HTML <title> element.

func GetTitle added in v1.10.0

func GetTitle(trimSuffix bool, url string) (string, int, error)

GetTitle returns the string value of the HTML <title> element and status code of a URL.

func Outputs added in v1.10.0

func Outputs() []string

func Platforms added in v1.10.0

func Platforms() ([]string, error)

Platforms lists the operating systems required by the files.

func Sections added in v1.10.0

func Sections() ([]string, error)

Sections lists the categories of files.

func Sorts added in v1.10.0

func Sorts() []string

Types

type IDs added in v1.10.0

type IDs []int

IDs are the primary keys of the file records.

func GetBlocked added in v1.10.0

func GetBlocked() (IDs, error)

GetBlocked returns all the primary keys of the records with blocked file downloads.

func GetKeys added in v1.10.0

func GetKeys() (IDs, error)

GetKeys returns all the primary keys of the file records that are public.

func GetSoftDeleteKeys added in v1.10.0

func GetSoftDeleteKeys() (IDs, error)

GetSoftDeleteKeys returns all the primary keys of the file records that are not public and hidden.

func RandBlocked added in v1.10.0

func RandBlocked(count int) (int, IDs, error)

RandBlocked returns a randomized count of primary keys for records with blocked file downloads.

func RandDeleted added in v1.10.0

func RandDeleted(count int) (int, IDs, error)

RandDeleted returns a randomized count of primary keys for hidden file records.

func RandIDs added in v1.10.0

func RandIDs(count int) (int, IDs, error)

RandBlocked returns a randomized count of primary keys for public file records.

func (*IDs) Contains added in v1.10.0

func (a *IDs) Contains(x int) bool

Contains returns true whenever a contains x.

func (IDs) JoinPaths added in v1.10.0

func (a IDs) JoinPaths(base string, r Root) []string

JoinPaths return the URL strings of the IDs.

func (IDs) Randomize added in v1.10.0

func (a IDs) Randomize(x int) (IDs, error)

Randomize the IDs and returns the first x results.

type Options added in v1.10.0

type Options struct {
	Output   string `url:"output"`
	Platform string `url:"platform"`
	Section  string `url:"section"`
	Sort     string `url:"sort"`
}

type Root added in v1.10.0

type Root int

Root URL element.

const (
	File     Root = iota // File URL element.
	Download             // Download URL element.
)

func (Root) String added in v1.10.0

func (r Root) String() string

type Style added in v1.10.0

type Style int

Style the result of a link and its status code.

const (
	LinkNotFound Style = iota // LinkNotFound first prints the link and expects 404 status codes.
	LinkSuccess               // LinkSuccess first prints the link and expects 200 status codes.
	NotFound                  // NotFound expects 404 status codes.
	Success                   // Success expects 200 status codes.
)

func (Style) Range added in v1.10.0

func (p Style) Range(urls []string)

Range over the file URLs.

func (Style) RangeFiles added in v1.10.0

func (p Style) RangeFiles(urls []string)

RangeFiles ranges over the file download URLs.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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