-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate template files when making new blog
GitHub #1
- Loading branch information
Showing
6 changed files
with
58 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package main | ||
|
||
const baseTmpl string = `{{define "base"}} | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<title>{{template "title" .}}</title> | ||
</head> | ||
<body> | ||
{{template "header" .}} | ||
{{template "body" .}} | ||
</body> | ||
</html> | ||
{{end}} | ||
` | ||
|
||
const headerTmpl string = `{{define "header"}} | ||
<h1><a href="/">{{.Blog.Title}}</a></h1> | ||
<p>{{.Blog.Tagline}}</p> | ||
{{end}} | ||
` | ||
|
||
const postTmpl string = `{{define "title"}} | ||
{{.Post.Title}} - {{.Blog.Title}} | ||
{{end}} | ||
{{define "body"}} | ||
<h2>{{.Post.Title}}</h2> | ||
{{.Post.Content}} | ||
<p>Posted: {{.Post.Date | formatDate}}</p> | ||
<a href="/archive/">See all posts »</a> | ||
{{end}} | ||
` | ||
|
||
const archiveTmpl string = `{{define "title"}} | ||
All Posts - {{.Blog.Title}} | ||
{{end}} | ||
{{define "body"}} | ||
<ul> | ||
{{range .Posts}} | ||
<li>{{.Date | formatDate}} <a href="/{{.Slug}}">{{.Title}}</a></li> | ||
{{end}} | ||
</ul> | ||
{{end}} | ||
` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.