]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
Make site.BaseURL and $pager.URL a string
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 30 Oct 2023 08:07:03 +0000 (09:07 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 30 Oct 2023 09:26:06 +0000 (10:26 +0100)
Was template.URL.

hugolib/site_new.go
resources/page/pagination.go
resources/page/pagination_test.go
resources/page/site.go

index 127b0e296b9b80c65dbd45f637b0e9dc20693fff..ac59e01c7abd2326b34ac659873862310138434a 100644 (file)
@@ -417,8 +417,8 @@ func (s *Site) Hugo() hugo.HugoInfo {
 }
 
 // Returns the BaseURL for this Site.
-func (s *Site) BaseURL() template.URL {
-       return template.URL(s.conf.C.BaseURL.WithPath)
+func (s *Site) BaseURL() string {
+       return s.conf.C.BaseURL.WithPath
 }
 
 // Returns the last modification date of the content.
index a4605fa8ee144bce53a89b4b086e0fe3faa3be3f..9113b60622080e7058e074eec1b46b5c927361ab 100644 (file)
@@ -16,7 +16,6 @@ package page
 import (
        "errors"
        "fmt"
-       "html/template"
        "math"
        "reflect"
 
@@ -71,8 +70,8 @@ func (p *Pager) PageNumber() int {
 }
 
 // URL returns the URL to the current page.
-func (p *Pager) URL() template.HTML {
-       return template.HTML(p.paginationURLFactory(p.PageNumber()))
+func (p *Pager) URL() string {
+       return p.paginationURLFactory(p.PageNumber())
 }
 
 // Pages returns the Pages on this page.
index 1e115d62b4edcb4d18ef92deb1fb9d964da753f3..487b36adb1b121d4db63f061ed6b60c2e39437a9 100644 (file)
@@ -16,7 +16,6 @@ package page
 import (
        "context"
        "fmt"
-       "html/template"
        "testing"
 
        qt "github.com/frankban/quicktest"
@@ -119,7 +118,7 @@ func doTestPages(t *testing.T, paginator *Paginator) {
        c.Assert(paginator.TotalPages(), qt.Equals, 5)
 
        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.HasNext(), qt.Equals, true)
        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])
 
        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.HasNext(), qt.Equals, false)
        c.Assert(last.Next(), qt.IsNil)
index ba2759a06188157934242bd8339171baa19368d1..0480ce674a9fe172522e32dd1010106fbe442d9e 100644 (file)
@@ -82,7 +82,7 @@ type Site interface {
        Hugo() hugo.HugoInfo
 
        // Returns the BaseURL for this Site.
-       BaseURL() template.URL
+       BaseURL() string
 
        // Returns a taxonomy map.
        Taxonomies() TaxonomyList
@@ -172,6 +172,7 @@ func (s *siteWrapper) Social() map[string]string {
 func (s *siteWrapper) Author() map[string]interface{} {
        return s.s.Author()
 }
+
 func (s *siteWrapper) Authors() AuthorList {
        return AuthorList{}
 }
@@ -250,7 +251,7 @@ func (s *siteWrapper) Hugo() hugo.HugoInfo {
        return s.s.Hugo()
 }
 
-func (s *siteWrapper) BaseURL() template.URL {
+func (s *siteWrapper) BaseURL() string {
        return s.s.BaseURL()
 }
 
@@ -319,6 +320,7 @@ type testSite struct {
 func (s testSite) Author() map[string]interface{} {
        return nil
 }
+
 func (s testSite) Authors() AuthorList {
        return AuthorList{}
 }
@@ -421,7 +423,7 @@ func (t testSite) Taxonomies() TaxonomyList {
        return nil
 }
 
-func (t testSite) BaseURL() template.URL {
+func (t testSite) BaseURL() string {
        return ""
 }