Home Download Docs Code Community
import "perkeep/pkg/publish"
Overview
Index

Overview ▾

Package publish exposes the types and functions that can be used from a Go template, for publishing.

Index

type MemberFileInfo
type Nav
type PageFile
type PageHeader
type PageMembers
type SubjectPage

Package files

types.go

type MemberFileInfo

type MemberFileInfo struct {
    FileName         string
    FileDomID        string
    FilePath         string
    FileThumbnailURL string
}

MemberFileInfo contains the file related data available for each member, if the member is the permanode for a file.

type Nav struct {
    ParentPath string
    PrevPath   string
    NextPath   string
}

Nav holds links to the previous, next, and parent elements, when displaying members.

type PageFile

type PageFile struct {
    FileName     string
    Size         int64
    MIMEType     string
    IsImage      bool
    DownloadURL  string
    ThumbnailURL string
    DomID        string
    Nav          func() *Nav
}

PageFile contains the file related data available to the subject template, if the page describes some file contents.

type PageHeader struct {
    Title         string      // Page title.
    CSSFiles      []string    // Available CSS files.
    JSDeps        []string    // Dependencies (for e.g closure) that can/should be included as javascript files.
    CamliClosure  template.JS // Closure namespace defined in the provided js. e.g camlistore.GalleryPage from pics.js
    Subject       blob.Ref    // Subject of this page (i.e the object which is described and published).
    ViewerIsOwner bool        // Whether the viewer of the page is also the owner of the displayed subject. (localhost check for now.)
    PublishedRoot blob.Ref    // Root permanode for this publisher. On camliRoot, camliPath:somePath = publishedRoot
    // SubjectBasePath is the URL path up to the digest prefix of the
    // subject. e.g. "/pics/foo/-/h341b133369" or "/pics/foo/-" if the subject
    // is the published root itself.
    SubjectBasePath string
    // PathPrefix is the publisher app handler prefix on Perkeep, e.g.
    // "/pics/", or "/" if the request was not proxied through Perkeep.
    PathPrefix string
    Host       string
}

PageHeader contains the data available to the template, and relevant to the page header.

type PageMembers

type PageMembers struct {
    SubjectPath string                                      // URL prefix path to the subject (i.e the permanode).
    ZipName     string                                      // Name of the downloadable zip file which contains all the members.
    Members     []*search.DescribedBlob                     // List of the members.
    Description func(*search.DescribedBlob) string          // Returns the description of the given member.
    Title       func(*search.DescribedBlob) string          // Returns the title for the given member.
    Path        func(*search.DescribedBlob) string          // Returns the url prefix path to the given the member.
    DomID       func(*search.DescribedBlob) string          // Returns the Dom ID of the given member.
    FileInfo    func(*search.DescribedBlob) *MemberFileInfo // Returns some file info if the given member is a file permanode.
}

PageMembers contains the data relevant to the members if the published subject is a permanode with members.

type SubjectPage

type SubjectPage struct {
    Header  func() *PageHeader
    File    func() *PageFile
    Members func() *PageMembers
}

SubjectPage is the data structure used when serving a publishing template. It contains the functions that can be called from the template.

Website layout inspired by memcached.
Content by the authors.