fixing bootstrap sample
@ -15,6 +15,7 @@ type builder struct{}
|
||||
|
||||
func (b *builder) Build(contentDir, buildDir, cacheDir string) {
|
||||
errs := goldsmith.Begin(contentDir).
|
||||
Cache(cacheDir).
|
||||
Chain(frontmatter.New()).
|
||||
Chain(markdown.New()).
|
||||
Chain(layout.New()).
|
||||
|
@ -3,6 +3,5 @@ Area = "blog"
|
||||
CrumbName = "blog"
|
||||
Layout = "collection"
|
||||
Title = "Blog"
|
||||
Paginate = true
|
||||
+++
|
||||
|
16
bootstrap/content/layouts/collection.gohtml
Normal file
@ -0,0 +1,16 @@
|
||||
{{define "collection"}}
|
||||
{{template "header" .}}
|
||||
{{template "navbar" .}}
|
||||
<div class="container">
|
||||
{{range .Meta.Groups.Blog}}
|
||||
<div>
|
||||
<h2><a href="{{.Path}}">{{.Meta.Title}}</a></h2>
|
||||
<p>
|
||||
{{.Meta.Summary}}
|
||||
<a href="{{.Path}}">…</a>
|
||||
</p>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
{{end}}
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
@ -1,52 +0,0 @@
|
||||
{{define "collection"}}
|
||||
{{template "header" .}}
|
||||
{{template "navbar" .}}
|
||||
<div class="container">
|
||||
{{range .Meta.Pager.PageCurr.Items}}
|
||||
<div>
|
||||
<h2><a href="{{.Path}}">{{.Meta.Title}}</a></h2>
|
||||
<p>
|
||||
{{.Meta.Summary.Summary}}
|
||||
<a href="{{.Path}}">[…more]</a>
|
||||
</p>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .Meta.Pager.Paged}}
|
||||
<ul class="pagination justify-content-center">
|
||||
{{if .Meta.Pager.PageCurr.Prev}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageCurr.Prev.File.Path}}" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1">Previous</a>
|
||||
</li>
|
||||
{{end}}
|
||||
|
||||
{{range .Meta.Pager.PagesAll}}
|
||||
{{if eq $.Meta.Pager.PageCurr.Index .Index}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#">{{.Index}}</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.File.Path}}">{{.Index}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{if .Meta.Pager.PageCurr.Next}}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="{{.Meta.Pager.PageCurr.Next.File.Path}}" tabindex="-1">Next</a>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="page-item disabled">
|
||||
<a class="page-link" href="#" tabindex="-1">Next</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
</div>
|
||||
{{template "footer" .}}
|
||||
{{end}}
|
@ -1,25 +1,3 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Alex Yatskov <alex@foosoft.net>
|
||||
* Author: Alex Yatskov <alex@foosoft.net>
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@ -29,15 +7,14 @@ import (
|
||||
"github.com/FooSoft/goldsmith"
|
||||
"github.com/FooSoft/goldsmith-components/devserver"
|
||||
"github.com/FooSoft/goldsmith-components/filters/condition"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/abs"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/absolute"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/breadcrumbs"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/collection"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/dom"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/document"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/frontmatter"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/index"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/layout"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/markdown"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/paginate"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/summary"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/syntax"
|
||||
"github.com/FooSoft/goldsmith-components/plugins/tags"
|
||||
@ -63,7 +40,7 @@ type builder struct {
|
||||
root string
|
||||
}
|
||||
|
||||
func (b *builder) Build(srcDir, dstDir string) {
|
||||
func (b *builder) Build(contentDir, buildDir, cacheDir string) {
|
||||
tagMeta := map[string]interface{}{
|
||||
"Area": "tags",
|
||||
"CrumbParent": "tags",
|
||||
@ -74,23 +51,23 @@ func (b *builder) Build(srcDir, dstDir string) {
|
||||
"Layout": "index",
|
||||
}
|
||||
|
||||
errs := goldsmith.Begin(srcDir).
|
||||
errs := goldsmith.Begin(contentDir).
|
||||
Cache(cacheDir).
|
||||
Chain(frontmatter.New()).
|
||||
Chain(markdown.New()).
|
||||
Chain(summary.New()).
|
||||
Chain(collection.New()).
|
||||
Chain(paginate.New("Groups.Blog").InheritKeys("Layout").ItemsPerPage(4)).
|
||||
Chain(index.New(indexMeta)).
|
||||
Chain(tags.New().IndexMeta(tagMeta)).
|
||||
Chain(breadcrumbs.New()).
|
||||
Chain(layout.New("layouts/*.html")).
|
||||
Chain(layout.New()).
|
||||
Chain(syntax.New().Placement(syntax.PlaceInline)).
|
||||
Chain(dom.New(fixup)).
|
||||
Chain(document.New(fixup)).
|
||||
Chain(thumbnail.New()).
|
||||
FilterPush(condition.New(len(b.root) > 0)).
|
||||
Chain(abs.New().BaseURL(b.root)).
|
||||
Chain(absolute.New().BaseUrl(b.root)).
|
||||
FilterPop().
|
||||
End(dstDir)
|
||||
End(buildDir)
|
||||
|
||||
for _, err := range errs {
|
||||
log.Print(err)
|
||||
@ -98,11 +75,9 @@ func (b *builder) Build(srcDir, dstDir string) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
var (
|
||||
dst = flag.String("dst", "dst", "destination directory")
|
||||
root = flag.String("root", "", "root directory")
|
||||
port = flag.Int("port", 8080, "server port")
|
||||
)
|
||||
root := flag.String("root", "", "server root")
|
||||
port := flag.Int("port", 8080, "server port")
|
||||
flag.Parse()
|
||||
devserver.DevServe(&builder{*root}, *port, "src", *dst, "layouts")
|
||||
|
||||
devserver.DevServe(&builder{*root}, *port, "content", "build", "cache")
|
||||
}
|
||||
|