Documentation
¶
Overview ¶
Package saebr provides a simple blog or CMS for running on App Engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run runs saebr.
saebr makes the following assumptions:
- It's running on Google App Engine, so runs as an unencrypted HTTP server. (App Engine can provide HTTPS and HTTP/2.)
- Run can exit the program (using log.Fatal) if an error occurs.
- Serving port is given by the PORT env var, or if empty assumes 8080.
Types ¶
type Option ¶
type Option func(*options)
Option is the type of each functional option to Run.
func CacheMaxSize ¶
CacheMaxSize configures the maximum size for the page cache. The default is 10000.
func DatastoreProjectID ¶
DatastoreProjectID sets the project ID used for the Cloud Datastore client. The default is the empty string (the client then obtains the project ID from the DATASTORE_PROJECT_ID env var).
func RootServeAction ¶
func RootServeAction(sa ServeAction) Option
RootServeAction changes how the root of the site is handled.
func TemplateFuncs ¶
TemplateFuncs allows providing custom template functions. Can be passed multiple times.
type Page ¶
type Page struct { Key *datastore.Key `datastore:"__key__"` Title string Created time.Time LastModified time.Time Published bool Blog bool Category string Tags []string Description string `datastore:",noindex"` Contents string `datastore:",noindex"` Prev, Next *datastore.Key `datastore:",noindex"` // contains filtered or unexported fields }
Page is the type of each blog post or page.
func (*Page) Edited ¶
Edited reports if the created and last-modified timestamps are different by more than 12 hours.
type ServeAction ¶
type ServeAction int
ServeAction describes some possible actions for handling a request.
const ( RedirectToLatest ServeAction = iota // Redirect to latest post canonical ServeLatest // Serve a copy of the latest post ServeDefault // Serve a normal page (key "default") )
Values for ServeAction.
type Site ¶
type Site struct { Key *datastore.Key `datastore:"__key__"` URLBase string `datastore:",noindex"` PageTemplate string `datastore:",noindex"` AdminEmail string `datastore:",noindex"` Secret string `datastore:",noindex"` WebSignInClientID string `datastore:",noindex"` FeedTitle string `datastore:",noindex"` FeedSubtitle string `datastore:",noindex"` FeedDescription string `datastore:",noindex"` FeedAuthor string `datastore:",noindex"` FeedCopyright string `datastore:",noindex"` TimeLocation string `datastore:",noindex"` // contains filtered or unexported fields }
Site is the root of a site, and contains the page template and other site-wide metadata.