newslab

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package newslab is NewsLab, a news site: HTML home, section and article pages, an RSS feed and a JSON API, behind a page cache of the kind a CDN or reverse proxy provides (Cache-Control, ETag, Age and X-Cache headers, conditional requests). Pages are rendered by a small origin that can render four at a time. It is the reference app for the content pack.

Planted bottlenecks (see README.md), each switched off by a fix flag:

  • stampede: when a page is not cached, every request for it renders it, so a popular page that expires or is purged sends a crowd to the origin at once (fix "stampede" lets one request render while the others wait for its result).
  • purge: publishing an article empties the whole cache, so every update during breaking news makes the site cold (fix "purge" removes only the pages the article appears on).
  • cachekey: the cache key is the full URL, tracking parameters included, so readers arriving from social links (utm_source, fbclid ...) never hit the cache (fix "cachekey" drops tracking parameters and sorts the rest).

Index

Constants

View Source
const (
	// Articles is how many articles NewsLab starts with (story-00001 ...).
	Articles = 20000
	// EditorToken is the bearer token the newsroom publishes with.
	EditorToken = "newslab-editor"
)

Variables

This section is empty.

Functions

func New

func New(cfg labkit.Config) http.Handler

New returns NewsLab's handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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