mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Make site.BaseURL and $pager.URL a string
Was template.URL.
This commit is contained in:
parent
acf01bfb78
commit
b6a7568131
4 changed files with 11 additions and 11 deletions
|
@ -417,8 +417,8 @@ func (s *Site) Hugo() hugo.HugoInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the BaseURL for this Site.
|
// Returns the BaseURL for this Site.
|
||||||
func (s *Site) BaseURL() template.URL {
|
func (s *Site) BaseURL() string {
|
||||||
return template.URL(s.conf.C.BaseURL.WithPath)
|
return s.conf.C.BaseURL.WithPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the last modification date of the content.
|
// Returns the last modification date of the content.
|
||||||
|
|
|
@ -16,7 +16,6 @@ package page
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
@ -71,8 +70,8 @@ func (p *Pager) PageNumber() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// URL returns the URL to the current page.
|
// URL returns the URL to the current page.
|
||||||
func (p *Pager) URL() template.HTML {
|
func (p *Pager) URL() string {
|
||||||
return template.HTML(p.paginationURLFactory(p.PageNumber()))
|
return p.paginationURLFactory(p.PageNumber())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pages returns the Pages on this page.
|
// Pages returns the Pages on this page.
|
||||||
|
|
|
@ -16,7 +16,6 @@ package page
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
qt "github.com/frankban/quicktest"
|
qt "github.com/frankban/quicktest"
|
||||||
|
@ -119,7 +118,7 @@ func doTestPages(t *testing.T, paginator *Paginator) {
|
||||||
c.Assert(paginator.TotalPages(), qt.Equals, 5)
|
c.Assert(paginator.TotalPages(), qt.Equals, 5)
|
||||||
|
|
||||||
first := paginatorPages[0]
|
first := paginatorPages[0]
|
||||||
c.Assert(first.URL(), qt.Equals, template.HTML("page/1/"))
|
c.Assert(first.URL(), qt.Equals, "page/1/")
|
||||||
c.Assert(first.First(), qt.Equals, first)
|
c.Assert(first.First(), qt.Equals, first)
|
||||||
c.Assert(first.HasNext(), qt.Equals, true)
|
c.Assert(first.HasNext(), qt.Equals, true)
|
||||||
c.Assert(first.Next(), qt.Equals, paginatorPages[1])
|
c.Assert(first.Next(), qt.Equals, paginatorPages[1])
|
||||||
|
@ -134,7 +133,7 @@ func doTestPages(t *testing.T, paginator *Paginator) {
|
||||||
c.Assert(third.Prev(), qt.Equals, paginatorPages[1])
|
c.Assert(third.Prev(), qt.Equals, paginatorPages[1])
|
||||||
|
|
||||||
last := paginatorPages[4]
|
last := paginatorPages[4]
|
||||||
c.Assert(last.URL(), qt.Equals, template.HTML("page/5/"))
|
c.Assert(last.URL(), qt.Equals, "page/5/")
|
||||||
c.Assert(last.Last(), qt.Equals, last)
|
c.Assert(last.Last(), qt.Equals, last)
|
||||||
c.Assert(last.HasNext(), qt.Equals, false)
|
c.Assert(last.HasNext(), qt.Equals, false)
|
||||||
c.Assert(last.Next(), qt.IsNil)
|
c.Assert(last.Next(), qt.IsNil)
|
||||||
|
|
|
@ -82,7 +82,7 @@ type Site interface {
|
||||||
Hugo() hugo.HugoInfo
|
Hugo() hugo.HugoInfo
|
||||||
|
|
||||||
// Returns the BaseURL for this Site.
|
// Returns the BaseURL for this Site.
|
||||||
BaseURL() template.URL
|
BaseURL() string
|
||||||
|
|
||||||
// Returns a taxonomy map.
|
// Returns a taxonomy map.
|
||||||
Taxonomies() TaxonomyList
|
Taxonomies() TaxonomyList
|
||||||
|
@ -172,6 +172,7 @@ func (s *siteWrapper) Social() map[string]string {
|
||||||
func (s *siteWrapper) Author() map[string]interface{} {
|
func (s *siteWrapper) Author() map[string]interface{} {
|
||||||
return s.s.Author()
|
return s.s.Author()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *siteWrapper) Authors() AuthorList {
|
func (s *siteWrapper) Authors() AuthorList {
|
||||||
return AuthorList{}
|
return AuthorList{}
|
||||||
}
|
}
|
||||||
|
@ -250,7 +251,7 @@ func (s *siteWrapper) Hugo() hugo.HugoInfo {
|
||||||
return s.s.Hugo()
|
return s.s.Hugo()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *siteWrapper) BaseURL() template.URL {
|
func (s *siteWrapper) BaseURL() string {
|
||||||
return s.s.BaseURL()
|
return s.s.BaseURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +320,7 @@ type testSite struct {
|
||||||
func (s testSite) Author() map[string]interface{} {
|
func (s testSite) Author() map[string]interface{} {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s testSite) Authors() AuthorList {
|
func (s testSite) Authors() AuthorList {
|
||||||
return AuthorList{}
|
return AuthorList{}
|
||||||
}
|
}
|
||||||
|
@ -421,7 +423,7 @@ func (t testSite) Taxonomies() TaxonomyList {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t testSite) BaseURL() template.URL {
|
func (t testSite) BaseURL() string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue