snewsletter

package
v0.0.0-...-43e1acc Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageOrientationLandscape = "landscape"
	ImageOrientationPortrait  = "portrait"
)

Possible orientations for a newsletter's main image.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	// Content is the HTML content of the issue. It isn't included as TOML
	// frontmatter, and is rather split out of an issue's Markdown file,
	// rendered, and then added separately.
	Content string `toml:"-"`

	// ContentRaw is the raw Markdown content of the issue.
	ContentRaw string `toml:"-"`

	// Draft indicates that the issue is not yet published.
	Draft bool `toml:"-"`

	// HookImageURL is the URL for a hook image for the issue (to be shown on
	// the newsletter index) if one was found. Should generally be the same
	// image as ImageURL.
	HookImageURL string `toml:"-"`

	// ImageAlt is the alternate description text for the issue's main image.
	//
	// Currently not used by Passages.
	ImageAlt string `toml:"image_alt"`

	// ImageOrientation is the orientation of the main image (either landscape
	// or portrait).
	//
	// Currently not used by Passages.
	ImageOrientation string `toml:"image_orientation"`

	// ImageURL is the source URL for the issue's main image.
	//
	// Currently not used by Passages.
	ImageURL string `toml:"image_url"`

	// Number is the number of the issue like "001". Notably, it's a number,
	// but zero-padded.
	Number string `toml:"-"`

	// PublishedAt is when the issue was published.
	PublishedAt time.Time `toml:"published_at"`

	// Slug is a unique identifier for the issue that also helps determine
	// where it's addressable by URL. It's a combination of an issue number
	// (like `001` and a short identifier).
	Slug string `toml:"-"`

	// Title is the issue's title.
	Title string `toml:"title"`
}

Issue represents a single burst of the Nanoglyph or Passages & Glass newsletters to be rendered.

func Render

func Render(c *modulir.Context, dir, name, absoluteURL string, email bool) (*Issue, error)

Render reads a newsletter file and builds an Issue object from it.

The email parameter specifies whether or not the issue is being rendered to be sent it an email (as opposed for rendering on the web) and affects things like whether images should use absolute URLs.

Jump to

Keyboard shortcuts

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