blog

package
v0.0.0-...-1bc63cf Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Blog

func Blog(w http.ResponseWriter, r *http.Request)

Blog returns the blog index page with all of the blog posts

func Post

func Post(w http.ResponseWriter, r *http.Request)

Post renders a HTML page with a single blog post.

Types

type Page

type Page struct {
	Title string
	Paths []helpers.Path
	Posts []PostData
}

Page contains all of the data to render the blog index

type PostData

type PostData struct {
	Title string
	Text  string
	Slug  string
}

PostData contains the data for a blog post

func GetBlogPostBySlug

func GetBlogPostBySlug(db *sql.DB, slug string) (PostData, error)

GetBlogPostBySlug returns the blog post associated with the slug variable sent in.

func GetBlogPosts

func GetBlogPosts(db *sql.DB) ([]PostData, error)

GetBlogPosts gets all of the blog posts from the database.

type PostPage

type PostPage struct {
	Title string
	Paths []helpers.Path
	Post  PostData
	Posts []PostData
}

PostPage contains all of the data for a single blog post

Jump to

Keyboard shortcuts

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