Categorygithub.com/fragmenta/view
repositorypackage
1.6.2
Repository: https://github.com/fragmenta/view.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

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