mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
adding previous next capabilities
This commit is contained in:
parent
d36d7fba6a
commit
ddad1e04ac
2 changed files with 32 additions and 6 deletions
21
README.md
21
README.md
|
@ -68,6 +68,7 @@ If you don't intend to contribute, it's even easier.
|
||||||
#### Running Hugo
|
#### Running Hugo
|
||||||
|
|
||||||
cd /path/to/hugo
|
cd /path/to/hugo
|
||||||
|
go install github.com/spf13/hugo/hugolibs
|
||||||
go run main.go
|
go run main.go
|
||||||
|
|
||||||
#### Building Hugo
|
#### Building Hugo
|
||||||
|
@ -118,7 +119,7 @@ An example directory may look like:
|
||||||
| | └── youtube.html
|
| | └── youtube.html
|
||||||
| ├── index.html
|
| ├── index.html
|
||||||
| └── rss.xml
|
| └── rss.xml
|
||||||
└── public
|
└── static
|
||||||
|
|
||||||
This directory structure tells us a lot about this site:
|
This directory structure tells us a lot about this site:
|
||||||
|
|
||||||
|
@ -185,8 +186,9 @@ Make sure either hugo is in your path or provide a path to it.
|
||||||
$ hugo --help
|
$ hugo --help
|
||||||
usage: hugo [flags] []
|
usage: hugo [flags] []
|
||||||
-b, --base-url="": hostname (and path) to the root eg. http://spf13.com/
|
-b, --base-url="": hostname (and path) to the root eg. http://spf13.com/
|
||||||
-d, --build-drafts=false: include content marked as draft
|
-D, --build-drafts=false: include content marked as draft
|
||||||
--config="": config file (default is path/config.yaml|json|toml)
|
--config="": config file (default is path/config.yaml|json|toml)
|
||||||
|
-d, --destination="": filesystem path to write files to
|
||||||
-h, --help=false: show this help
|
-h, --help=false: show this help
|
||||||
--port="1313": port to run web server on, default :1313
|
--port="1313": port to run web server on, default :1313
|
||||||
-S, --server=false: run a (very) simple web server
|
-S, --server=false: run a (very) simple web server
|
||||||
|
@ -214,6 +216,7 @@ your browser to view the changes.**
|
||||||
Watching for changes. Press ctrl+c to stop
|
Watching for changes. Press ctrl+c to stop
|
||||||
15 pages created
|
15 pages created
|
||||||
0 tags created
|
0 tags created
|
||||||
|
in 8 ms
|
||||||
|
|
||||||
Hugo can even run a server and create your site at the same time!
|
Hugo can even run a server and create your site at the same time!
|
||||||
|
|
||||||
|
@ -221,6 +224,7 @@ Hugo can even run a server and create your site at the same time!
|
||||||
Watching for changes. Press ctrl+c to stop
|
Watching for changes. Press ctrl+c to stop
|
||||||
15 pages created
|
15 pages created
|
||||||
0 tags created
|
0 tags created
|
||||||
|
in 8 ms
|
||||||
Web Server is available at http://localhost:1313
|
Web Server is available at http://localhost:1313
|
||||||
Press ctrl+c to stop
|
Press ctrl+c to stop
|
||||||
|
|
||||||
|
@ -527,6 +531,17 @@ To check if a parameter has been provided use the isset method provided by Hugo.
|
||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
* **0.8.0** August 1, 2013
|
||||||
|
* Added support for pretty urls (filename/index.html vs filename.html)
|
||||||
|
* Hugo supports a destination directory
|
||||||
|
* Will efficiently sync content in static to destination directory
|
||||||
|
* Cleaned up options.. now with support for short and long options
|
||||||
|
* Added support for TOML
|
||||||
|
* Added support for YAML
|
||||||
|
* Added support for Previous & Next
|
||||||
|
* Support for Series
|
||||||
|
* Adding verbose output
|
||||||
|
* Loads of bugfixes
|
||||||
* **0.7.0** July 4, 2013
|
* **0.7.0** July 4, 2013
|
||||||
* Hugo now includes a simple server
|
* Hugo now includes a simple server
|
||||||
* First public release
|
* First public release
|
||||||
|
@ -544,8 +559,6 @@ In no particular order, here is what I'm working on:
|
||||||
* Syntax highlighting
|
* Syntax highlighting
|
||||||
* Previous & Next
|
* Previous & Next
|
||||||
* Related Posts
|
* Related Posts
|
||||||
* Support for TOML front matter -- in head
|
|
||||||
* Proper YAML support for front matter -- in head
|
|
||||||
* Support for other formats
|
* Support for other formats
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
|
@ -16,6 +16,7 @@ package hugolib
|
||||||
import (
|
import (
|
||||||
"bitbucket.org/pkg/inflect"
|
"bitbucket.org/pkg/inflect"
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/spf13/nitro"
|
"github.com/spf13/nitro"
|
||||||
"html/template"
|
"html/template"
|
||||||
|
@ -24,7 +25,6 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"errors"
|
|
||||||
//"sync"
|
//"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -74,11 +74,12 @@ func (site *Site) Analyze() {
|
||||||
site.checkDescriptions()
|
site.checkDescriptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (site *Site) Process() (err error){
|
func (site *Site) Process() (err error) {
|
||||||
site.initialize()
|
site.initialize()
|
||||||
site.prepTemplates()
|
site.prepTemplates()
|
||||||
site.timer.Step("initialize & template prep")
|
site.timer.Step("initialize & template prep")
|
||||||
site.CreatePages()
|
site.CreatePages()
|
||||||
|
site.setupPrevNext()
|
||||||
site.timer.Step("import pages")
|
site.timer.Step("import pages")
|
||||||
if err = site.BuildSiteMeta(); err != nil {
|
if err = site.BuildSiteMeta(); err != nil {
|
||||||
return
|
return
|
||||||
|
@ -220,6 +221,18 @@ func (s *Site) CreatePages() {
|
||||||
s.Pages.Sort()
|
s.Pages.Sort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Site) setupPrevNext() {
|
||||||
|
for i, _ := range s.Pages {
|
||||||
|
if i < len(s.Pages)-1 {
|
||||||
|
s.Pages[i].Next = s.Pages[i+1]
|
||||||
|
}
|
||||||
|
|
||||||
|
if i > 0 {
|
||||||
|
s.Pages[i].Prev = s.Pages[i-1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Site) BuildSiteMeta() (err error) {
|
func (s *Site) BuildSiteMeta() (err error) {
|
||||||
s.Indexes = make(IndexList)
|
s.Indexes = make(IndexList)
|
||||||
s.Sections = make(Index)
|
s.Sections = make(Index)
|
||||||
|
|
Loading…
Reference in a new issue