Skip to content
/ view Public

Package view provides template registration, rendering, and helper functions for golang views

License

Notifications You must be signed in to change notification settings

fragmenta/view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

view

Package view provides template registration, rendering, and helper functions for golang views

Usage

Load templates on app startup:

	err := view.LoadTemplates()
	if err != nil {
		server.Fatalf("Error reading templates %s", err)
	}

Render a template

    // Set up the view
	view := view.New(context)
    // Add a key to the view
    view.AddKey("page", page)
    // Optionally set template, layout or other attributes
    view.Template("src/pages/views/home.html.got")
    // Render the view
    return view.Render()

Public subpackages:

  • helpers - utilities for handling files

About

Package view provides template registration, rendering, and helper functions for golang views

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages