templates

package
v0.132.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BodyFragment is a fragment key pointing to tbe body section of a page.
	BodyFragment templFragmentKey = "body"
	// ContentFragment is a fragment key pointing to the main content of a page.
	ContentFragment templFragmentKey = "content"
	// PaginateFragment is a fragment key pointing to the content to render when paginating.
	PaginateFragment templFragmentKey = "paginate"
)
View Source
const DefaultNotificationTimeout = 5 * time.Second
View Source
const ErrorFragment templFragmentKey = "error"

Variables

View Source
var (
	// ContentID points to the element containing the main content of the page.
	ContentID = models.ElementID("content")
	// NotificationsID points to an element that can be used for displaying notifications to the user.
	NotificationsID = models.ElementID("notifications")
)

Functions

func About added in v0.21.0

func About() templ.Component

func AccountSettings

func AccountSettings(user *models.User) templ.Component

func ActionSuggestionSubscriptions added in v0.73.0

func ActionSuggestionSubscriptions(subscriptions models.Subscriptions) templ.Component

func AddCategory

func AddCategory(category models.Category) templ.Component

AddCategory renders a new category item to the list of categories of a subscription.

func AddFeedSubscription

func AddFeedSubscription(request *models.FeedSubscriptionRequest) templ.Component

AddFeedSubscription is a page for adding a new subscription to a feed.

func AddGroupSubscription

func AddGroupSubscription(request *models.GroupSubscriptionRequest) templ.Component

AddGroupSubscription is a page for adding a new group subscription.

func AddSearchSubscription

func AddSearchSubscription(request *models.SearchSubscriptionRequest) templ.Component

AddSearchSubscription is a page for adding a new search subscription.

func AddSubscriptionToGroup added in v0.82.4

func AddSubscriptionToGroup(id, name string) templ.Component

AddSubscriptionToGroup renders a button indicating a subscription is part of a group subscription. Clicking the button removes it from the group.

func AdvancedSearch added in v0.81.1

func AdvancedSearch(request *models.SearchRequest, attributes templ.Attributes) templ.Component

func ArticleCard

func ArticleCard(idx int, article *models.Article) templ.Component

Card renders an article as a card, for displaying in a list.

func ArticleContent

func ArticleContent(article *models.Article) templ.Component

ArticleContent renders the complete content of an article.

func CategoryBadge added in v0.19.0

func CategoryBadge(category models.Category, options ...element.PropertiesOption) templ.Component

CategoryBadge renders a badge containing a category. Options can be used to apply additional styling or attributes (i.e. HTMX options) to the badge.

func CategoryFilters added in v0.78.0

func CategoryFilters(data *models.CategoryFilters) templ.Component

func CategoryManagement

func CategoryManagement(suggested []models.Category, existing []models.Category) templ.Component

func Comparison added in v0.95.0

func Comparison(service string) templ.Component

func Contact added in v0.129.0

func Contact() templ.Component

func CreatePage added in v0.36.0

func CreatePage(template templ.Component, options ...PageOption) templ.Component

CreatePage creates a new page with the given body template and additional options.

func DeactivateAccountModal

func DeactivateAccountModal() templ.Component

func DisplaySettings

func DisplaySettings(user *models.User) templ.Component

func Dock

func Dock(attributes templ.Attributes) templ.Component

func Document

func Document(data []byte) templ.Component

Document renders the given raw HTML data as full-page prose content. Used primarily for hosted markdown documents (i.e., privacy policy, terms of service, etc.)

func EditEmailSubscription added in v0.26.0

func EditEmailSubscription(request *models.EditEmailSubscriptionRequest) templ.Component

func EditFeedSubscription added in v0.82.4

func EditFeedSubscription(request *models.FeedSubscriptionRequest) templ.Component

EditFeedSubscription is a page for editing an existing feed subscription.

func EditGroupSubscription

func EditGroupSubscription(request *models.GroupSubscriptionRequest) templ.Component

EditGroupSubscription is a page for editing a group subscription.

func EditSearchSubscription

func EditSearchSubscription(request *models.SearchSubscriptionRequest) templ.Component

EditSearchSubscription is a page for editing a search subscription.

func ExportSubscriptions

func ExportSubscriptions() templ.Component

ExportSubscriptions renders a form for exporting all subscriptions as an OPML file.

func ExternalError

func ExternalError(user *models.User, msg *models.UserMessage) templ.Component

func FeatureAddContent added in v0.101.0

func FeatureAddContent(flipped bool) templ.Component

func FeatureArticleFilters added in v0.101.0

func FeatureArticleFilters(flipped bool) templ.Component

func FeatureEmailNewsletters added in v0.101.0

func FeatureEmailNewsletters(flipped bool) templ.Component

func FeatureFavorites added in v0.101.0

func FeatureFavorites(flipped bool) templ.Component

func FeatureFetchRemoteContent added in v0.101.0

func FeatureFetchRemoteContent(flipped bool) templ.Component

func FeatureGroupSubscriptions added in v0.101.0

func FeatureGroupSubscriptions(flipped bool) templ.Component

func FeatureImport added in v0.101.0

func FeatureImport(flipped bool) templ.Component

func FeatureLayout added in v0.101.0

func FeatureLayout(flipped bool) templ.Component

func FeatureSearchSubscription added in v0.101.0

func FeatureSearchSubscription(flipped bool) templ.Component

func FeatureSubscriptionCustomisation added in v0.101.0

func FeatureSubscriptionCustomisation(flipped bool) templ.Component

func FeatureThemes added in v0.101.0

func FeatureThemes(flipped bool) templ.Component

func Features added in v0.101.0

func Features() templ.Component

func FeaturesCollect added in v0.101.0

func FeaturesCollect() templ.Component

func FeaturesConsume added in v0.101.0

func FeaturesConsume() templ.Component

func FeaturesCurate added in v0.101.0

func FeaturesCurate() templ.Component

func FilterControls

func FilterControls(path string, filters *models.ListFilters) templ.Component

func HeaderExternal added in v0.101.0

func HeaderExternal() templ.Component

func ImportSubscriptions

func ImportSubscriptions() templ.Component

ImportSubscriptions renders a form for the user to select or drag and drop an OPML file to import their subscriptions.

func ImportSubscriptionsResults added in v0.82.4

func ImportSubscriptionsResults(results []models.FeedSubscriptionResult) templ.Component

ImportSubscriptionsResults renders the results of importing the users subscriptions.

func InternalError added in v0.36.0

func InternalError(user *models.User, msg *models.UserMessage) templ.Component

func Landing

func Landing() templ.Component

Landing is the landing page layout.

func LandingHeaderSlot added in v0.116.0

func LandingHeaderSlot() templ.Component

func ListArticles

func ListArticles(response *models.ListArticlesResponse) templ.Component

ListArticles renders the list of articles in a grid layout with filtering controls and an actions menu.

func ListFavorites added in v0.39.0

func ListFavorites(response *models.ListFavoritesResponse) templ.Component

ListFavorites renders subscription and article favorites in a grid layout.

func ListSubscriptions

func ListSubscriptions(response *models.ListSubscriptionsResponse) templ.Component

ListSubscriptions renders the list of subscriptions in a grid layout with filtering controls and an actions menu.

func NewFeaturePanel added in v0.101.0

func NewFeaturePanel(id string) templ.Component

func NewOpenGraphMetadata added in v0.70.0

func NewOpenGraphMetadata(options ...opengraph.Option) *opengraph.OpenGraph

NewMetadata creates a new opengraph Metadata object with properties set to values given by the options. Where a property is not set by an option, a default value will be used.

func NewUserHome

func NewUserHome() templ.Component

NewUserHome is a home page displayed for new users, with some instructions and actions to help them set up the app.

func NotFound

func NotFound() templ.Component

func Notification

func Notification(msg *models.UserMessage, timeout time.Duration) templ.Component

Notification renders a notification with the given user message.

func PathFromCtx added in v0.80.3

func PathFromCtx(ctx context.Context) string

PathFromCtx retrieves the URL path from the context.

func PathToCtx added in v0.80.3

func PathToCtx(ctx context.Context, path string) context.Context

PathToCtx stores the URL path in the context.

func PostsIndex added in v0.36.0

func PostsIndex(posts []*models.MarkdownFile) templ.Component

func RemoveSubscriptionModal

func RemoveSubscriptionModal(request *models.RemoveSubscriptionRequest, options ...element.PropertiesOption) templ.Component

RemoveObjectModal renders a modal that will action an unsubscribe request when the user has confirmed.

func RenderJSONLD added in v0.119.0

func RenderJSONLD(id string, data *json.RawMessage) templ.Component

func ReportIssue added in v0.131.3

func ReportIssue(details *models.ReportIssueRequest) templ.Component

ReportIssue renders a form for reporting issues with the app.

func Search() templ.Component

func SearchResults

func SearchResults(results *models.SearchResults) templ.Component

SearchResults renders the given articles returned from the given search in a grid layout with an actions menu.

func SearchSubscriptionFilterSuggestions

func SearchSubscriptionFilterSuggestions(subscriptions models.Subscriptions) templ.Component

func SearchSuggestions

func SearchSuggestions(suggestions *models.SearchResults) templ.Component

SearchSuggestions will render suggestions for a given search.

func ShareArticleModal added in v0.34.1

func ShareArticleModal(request *models.ShareArticleRequest) templ.Component

func ShowFeedSuggestions added in v0.110.0

func ShowFeedSuggestions(request *models.AddSubscriptionFeedSuggestions) templ.Component

func ShowNoSuggestions added in v0.110.0

func ShowNoSuggestions(text string) templ.Component

func ShowSubscriptionEmail added in v0.26.0

func ShowSubscriptionEmail(email string) templ.Component
func SideBar(attributes templ.Attributes) templ.Component

func SimilarArticles

func SimilarArticles(articles models.Articles) templ.Component

SimilarArticles renders a page of articles that are the result of a search for similar articles to a given input set.

func SubscriptionCard

func SubscriptionCard(idx int, s *models.Subscription) templ.Component

SubscriptionCard renders a subscription in a card format, suitable for showing together with other subscriptions in a list/grid. The idx argument is used to indicate the position of this subscription card relative to others in a grid/list (and is used for CSS-based animations).

func Unsubscribe added in v0.87.0

func Unsubscribe(token string) templ.Component

func UnsubscribeResult added in v0.87.0

func UnsubscribeResult(msg *models.UserMessage) templ.Component

func UpdateTitle added in v0.36.0

func UpdateTitle(title string) templ.Component

func UpdatesToast

func UpdatesToast(options ...element.PropertiesOption) templ.Component

UpdatesToast renders a toast notification to inform the user that updated content is available.

func UserAccountIssue

func UserAccountIssue() templ.Component

UserAccountIssuePage renders a full page with a message to the user indicating that their account has an issue that needs support to resolve. Usually, this will be displayed when a subscription plan payment has failed and requires manual intervention.

func UserAvatar

func UserAvatar(user *models.User, attributes templ.Attributes) templ.Component

func UserChooseSubscriptionPlan

func UserChooseSubscriptionPlan(user *models.User, planID string) templ.Component

UserChooseSubscriptionPlanPage renders a full page for the user to choose their subscription plan, with any previously selected option highlighted. This is displayed after a user account has been created (in Auth0) and redirects the user to Stripe for payment.

func UserHome added in v0.37.0

func UserHome(data *models.HomeResponse) templ.Component

UserHome is the default user home page.

func UserSettings added in v0.39.0

func UserSettings() templ.Component

func Viewer added in v0.21.0

func Viewer(feed *models.Feed, errMsg *models.UserMessage) templ.Component

func ViewerError added in v0.36.0

func ViewerError(msg *models.UserMessage) templ.Component

func ViewerResults added in v0.21.0

func ViewerResults(feed *models.Feed) templ.Component

func VsFeedly added in v0.95.0

func VsFeedly() templ.Component

func VsFeedlyMeta added in v0.117.0

func VsFeedlyMeta() templ.Component

func VsInoreader added in v0.95.0

func VsInoreader() templ.Component

func VsInoreaderMeta added in v0.117.0

func VsInoreaderMeta() templ.Component

Types

type Page

type Page struct {
	// Component is the main body content of the page.
	Component templ.Component
	// Title is a string for the (browser) titlebar.
	Title string
	// Description adds a meta tag with the given text.
	Description string
	// OGMetadata contains the Opengraph metadata for the page.
	OpenGraph *opengraph.OpenGraph
	// CanonicalLink is the link that will be used with <link rel="canonical> on the page.
	CanonicalLink string
}

Page contains data for rendering a full HTML page.

type PageOption added in v0.21.0

type PageOption func(*Page)

PageOption is a functional option applied to a page.

func WithCanonicalLink(link string) PageOption

WithCanonicalLink sets the <link rel="canonical> link for the page.

func WithOpenGraphMetadata added in v0.70.0

func WithOpenGraphMetadata(metadata *opengraph.OpenGraph) PageOption

WithOpenGraphMetadata option sets the given metadata as appropriate Open Graph tags in the page header.

func WithPageDescription added in v0.21.0

func WithPageDescription(desc string) PageOption

WithPageDescription option sets a description meta tag in the page header.

func WithPageTitle added in v0.21.0

func WithPageTitle(title string) PageOption

WithPageTitle option sets the page title (displayed in the browser titlebar).

type SideBarComponent

type SideBarComponent struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
helpers
mailto
Package mailto provides a method for easily constructing a mailto: string for use in links.
Package mailto provides a method for easily constructing a mailto: string for use in links.

Jump to

Keyboard shortcuts

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