~ritho/rweb

9b65ec12a5388caa27097d34883076a05e03b616 — Ritho 2 months ago dfeb324 v1.0.7
Improve the html templates.

Signed-off-by: Ritho <palvarez@ritho.net>
M assets/views/500.html => assets/views/500.html +1 -1
@@ 1,6 1,6 @@
{{define "500"}}
<!DOCTYPE html>
<html>
<html lang="en">
  {{template "head" .page.Head}}
  <body>
	{{template "header" .page.Header}}

M assets/views/blog.html => assets/views/blog.html +1 -1
@@ 1,6 1,6 @@
{{define "blog"}}
<!DOCTYPE html>
<html>
<html lang="en">
  {{template "head" .page.Head}}
  <body>
	{{template "header" .page.Header}}

M assets/views/head.html => assets/views/head.html +4 -4
@@ 1,10 1,10 @@
{{define "head"}}
<head>
  <meta charset="utf-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{.Title}}</title>
  <meta name="description" content="{{.Description}}"/>
  <meta name="description" content="{{.Description}}">
  {{range .CSS}}
  <link rel="stylesheet" href="/css/{{.}}">
  {{end}}

M assets/views/static.html => assets/views/static.html +1 -1
@@ 1,6 1,6 @@
{{define "static"}}
<!DOCTYPE html>
<html>
<html lang="en">
  {{template "head" .page.Head}}
  <body>
	{{template "header" .page.Header}}

M internal/engine/engine.go => internal/engine/engine.go +4 -4
@@ 71,13 71,13 @@ func (e *engine) Get(path string, params map[string][]string) (string, error) {
	var page pages.Page
	switch section.Type {
	case "page":
		page = static.New(&e.cfg.Site, sections, &section, e.cfg.Assets,
		page = static.New(&e.cfg.Site, &e.cfg.Server, sections, &section, e.cfg.Assets,
			e.templateFromPath(path))
	case "blog":
		page = blog.New(&e.cfg.Site, e.blogStorage, sections, &section, e.cfg.Assets,
			e.templateFromPath(path))
		page = blog.New(&e.cfg.Site, &e.cfg.Server, e.blogStorage, sections, &section,
			e.cfg.Assets, e.templateFromPath(path))
	case "projects":
		page = projects.New(&e.cfg.Site, sections, &section, e.cfg.Assets,
		page = projects.New(&e.cfg.Site, &e.cfg.Server, sections, &section, e.cfg.Assets,
			e.templateFromPath(path))
	default:
		e.logger.Error(fmt.Sprintf("Section type %s unknown", section.Type), "path", path,

M internal/engine/pages/blog/blog.go => internal/engine/pages/blog/blog.go +4 -1
@@ 39,6 39,7 @@ import (
// Blog engine.
type Blog struct {
	cfg        *config.Site
	srv        *config.Server
	storage    blog.Storage
	sections   []content.Section
	section    *config.Section


@@ 52,11 53,12 @@ type Blog struct {
}

// New returns a new static page.
func New(cfg *config.Site, storage blog.Storage, sections []content.Section,
func New(cfg *config.Site, srv *config.Server, storage blog.Storage, sections []content.Section,
	section *config.Section, assetsPath, content string,
) pages.Page {
	return &Blog{
		cfg:        cfg,
		srv:        srv,
		storage:    storage,
		section:    section,
		sections:   sections,


@@ 201,6 203,7 @@ func (b *Blog) Render() (string, error) {
			Title:       b.cfg.Title,
			Description: b.cfg.Description,
			CSS:         b.section.CSS,
			URL:         b.srv.Domain,
		},
		Header: content.Header{
			Title:    b.section.Title,

M internal/engine/pages/projects/projects.go => internal/engine/pages/projects/projects.go +4 -1
@@ 34,6 34,7 @@ import (
// Static represents a static web page.
type Static struct {
	cfg        *config.Site
	srv        *config.Server
	sections   []content.Section
	section    *config.Section
	assetsPath string


@@ 45,11 46,12 @@ type Static struct {
}

// New returns a new static page.
func New(cfg *config.Site, sections []content.Section, section *config.Section,
func New(cfg *config.Site, srv *config.Server, sections []content.Section, section *config.Section,
	assetsPath, content string,
) pages.Page {
	return &Static{
		cfg:        cfg,
		srv:        srv,
		section:    section,
		sections:   sections,
		assetsPath: assetsPath,


@@ 147,6 149,7 @@ func (s *Static) Render() (string, error) {
			Title:       s.cfg.Title,
			Description: s.cfg.Description,
			CSS:         s.section.CSS,
			URL:         s.srv.Domain,
		},
		Header: content.Header{
			Title:    s.section.Title,

M internal/engine/pages/static/static.go => internal/engine/pages/static/static.go +3 -1
@@ 38,6 38,7 @@ const (
// Static represents a static web page.
type Static struct {
	cfg        *config.Site
	srv        *config.Server
	sections   []content.Section
	section    *config.Section
	assetsPath string


@@ 49,11 50,12 @@ type Static struct {
}

// New returns a new static page.
func New(cfg *config.Site, sections []content.Section, section *config.Section,
func New(cfg *config.Site, srv *config.Server, sections []content.Section, section *config.Section,
	assetsPath, content string,
) pages.Page {
	return &Static{
		cfg:        cfg,
		srv:        srv,
		section:    section,
		sections:   sections,
		assetsPath: assetsPath,