mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 22:19:57 -05:00
Add support for Relative Permalinks
This commit is contained in:
parent
06da609138
commit
197aacb647
4 changed files with 14 additions and 55 deletions
|
@ -1,54 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Hugo Static Site Generator written in Go lang</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
||||||
{{ template "chrome/includes.html" . }}
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar"></div>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span3">
|
|
||||||
{{ template "chrome/menu.html" . }}
|
|
||||||
</div>
|
|
||||||
<div class="span9">
|
|
||||||
|
|
||||||
<div class="hero-unit" style="background-color: #222; color: #ccc;">
|
|
||||||
<h1>Hugo</h1>
|
|
||||||
<p>A Fast and Flexible Static Site Generator built with love by <a href="http://spf13.com">spf13</a>
|
|
||||||
and <a href="http://github.com/spf13/hugo/graphs/contributors">friends</a> in Go</p>
|
|
||||||
<p>
|
|
||||||
<a class="btn btn-large btn-success" href="/doc/installing">Get Started</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span4">
|
|
||||||
<h2>Fast
|
|
||||||
<br>
|
|
||||||
</h2>
|
|
||||||
<p>Written in GoLang for speed, Hugo is significantly faster than most
|
|
||||||
other static site generators.
|
|
||||||
A typical website of moderate size can be
|
|
||||||
rendered in a fraction of a second. A good rule of thumb is that Hugo
|
|
||||||
takes around 1 millisecond for each piece of content.<br>
|
|
||||||
It's so fast that it will render the site in
|
|
||||||
less time than it takes to switch to your browser and reload.</p>
|
|
||||||
</div>
|
|
||||||
<div class="span4">
|
|
||||||
<h2>Flexible</h2>
|
|
||||||
<p>Hugo is made to be very flexible. Define your own content types. Define
|
|
||||||
your own indexes. Build your own templates, shortcodes and more.
|
|
||||||
It is written to work well with any
|
|
||||||
kind of website including blogs, tumbles and docs.</p>
|
|
||||||
</div>
|
|
||||||
<div class="span4">
|
|
||||||
<h2>Fun</h2>
|
|
||||||
<p>Hugo runs everywhere. Sites generated with Hugo work on every web
|
|
||||||
server without any special configuration. Hugo
|
|
||||||
removes all the cruft of building a site allowing you to
|
|
||||||
focus on writing great content.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{ template "chrome/footer.html" }}
|
|
|
@ -253,6 +253,19 @@ func (p *Page) Permalink() (string, error) {
|
||||||
return link.String(), nil
|
return link.String(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Page) RelPermalink() (string, error) {
|
||||||
|
link, err := p.permalink()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
link.Scheme = ""
|
||||||
|
link.Host = ""
|
||||||
|
link.User = nil
|
||||||
|
link.Opaque = ""
|
||||||
|
return link.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (page *Page) handleTomlMetaData(datum []byte) (interface{}, error) {
|
func (page *Page) handleTomlMetaData(datum []byte) (interface{}, error) {
|
||||||
m := map[string]interface{}{}
|
m := map[string]interface{}{}
|
||||||
datum = removeTomlIdentifier(datum)
|
datum = removeTomlIdentifier(datum)
|
||||||
|
|
|
@ -551,7 +551,7 @@ func (s *Site) render(d interface{}, out string, layouts ...string) (err error)
|
||||||
section := ""
|
section := ""
|
||||||
page, ok := d.(*Page)
|
page, ok := d.(*Page)
|
||||||
if ok {
|
if ok {
|
||||||
section, _ = page.Permalink()
|
section, _ = page.RelPermalink()
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("Section is:", section)
|
fmt.Println("Section is:", section)
|
||||||
|
|
Loading…
Reference in a new issue