2019-01-02 06:33:26 -05:00
|
|
|
// Copyright 2019 The Hugo Authors. All rights reserved.
|
2017-08-17 04:24:17 -04:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2019-01-02 06:33:26 -05:00
|
|
|
package page
|
2018-02-22 03:15:12 -05:00
|
|
|
|
2019-01-02 06:33:26 -05:00
|
|
|
import (
|
|
|
|
"html/template"
|
|
|
|
"time"
|
|
|
|
|
2019-11-21 15:59:38 -05:00
|
|
|
"github.com/gohugoio/hugo/common/maps"
|
2023-01-04 12:24:36 -05:00
|
|
|
"github.com/gohugoio/hugo/config/privacy"
|
|
|
|
"github.com/gohugoio/hugo/config/services"
|
2023-01-24 14:57:15 -05:00
|
|
|
"github.com/gohugoio/hugo/identity"
|
2023-01-04 12:24:36 -05:00
|
|
|
"github.com/gohugoio/hugo/tpl"
|
2019-11-21 15:59:38 -05:00
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
"github.com/gohugoio/hugo/config"
|
|
|
|
|
2019-01-02 06:33:26 -05:00
|
|
|
"github.com/gohugoio/hugo/common/hugo"
|
|
|
|
"github.com/gohugoio/hugo/langs"
|
|
|
|
"github.com/gohugoio/hugo/navigation"
|
|
|
|
)
|
2017-08-17 04:24:17 -04:00
|
|
|
|
2022-12-30 03:20:58 -05:00
|
|
|
// Site represents a site. There can be multople sites in a multilingual setup.
|
2018-11-26 04:11:22 -05:00
|
|
|
type Site interface {
|
2022-04-21 04:59:13 -04:00
|
|
|
// Returns the Language configured for this Site.
|
2018-11-26 04:11:22 -05:00
|
|
|
Language() *langs.Language
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
// Returns all the languages configured for all sites.
|
|
|
|
Languages() langs.Languages
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
GetPage(ref ...string) (Page, error)
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
// AllPages returns all pages for all languages.
|
|
|
|
AllPages() Pages
|
|
|
|
|
2022-04-21 04:59:13 -04:00
|
|
|
// Returns all the regular Pages in this Site.
|
2019-01-02 06:33:26 -05:00
|
|
|
RegularPages() Pages
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns all Pages in this Site.
|
2019-01-02 06:33:26 -05:00
|
|
|
Pages() Pages
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-05-16 12:53:34 -04:00
|
|
|
// Returns all the top level sections.
|
|
|
|
Sections() Pages
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
// A shortcut to the home
|
2022-02-17 07:04:00 -05:00
|
|
|
Home() Page
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns true if we're running in a server.
|
2023-09-29 13:23:08 -04:00
|
|
|
// Deprecated: use hugo.IsServer instead
|
2018-11-26 04:11:22 -05:00
|
|
|
IsServer() bool
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns the server port.
|
2019-01-02 06:33:26 -05:00
|
|
|
ServerPort() int
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns the configured title for this Site.
|
2019-01-02 06:33:26 -05:00
|
|
|
Title() string
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
// Returns the configured language code for this Site.
|
2023-05-27 09:44:41 -04:00
|
|
|
// Deprecated: Use .Language.LanguageCode instead.
|
2023-01-04 12:24:36 -05:00
|
|
|
LanguageCode() string
|
|
|
|
|
|
|
|
// Returns the configured copyright information for this Site.
|
|
|
|
Copyright() string
|
|
|
|
|
2022-04-21 04:59:13 -04:00
|
|
|
// Returns all Sites for all languages.
|
2019-01-02 06:33:26 -05:00
|
|
|
Sites() Sites
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns Site currently rendering.
|
2022-04-05 03:57:58 -04:00
|
|
|
Current() Site
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns a struct with some information about the build.
|
2023-01-04 12:24:36 -05:00
|
|
|
Hugo() hugo.HugoInfo
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns the BaseURL for this Site.
|
2019-01-02 06:33:26 -05:00
|
|
|
BaseURL() template.URL
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-02-18 15:47:35 -05:00
|
|
|
// Returns a taxonomy map.
|
2022-12-30 03:20:58 -05:00
|
|
|
Taxonomies() TaxonomyList
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns the last modification date of the content.
|
2019-01-02 06:33:26 -05:00
|
|
|
LastChange() time.Time
|
2022-04-21 04:59:13 -04:00
|
|
|
|
|
|
|
// Returns the Menus for this site.
|
2019-01-02 06:33:26 -05:00
|
|
|
Menus() navigation.Menus
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
// The main sections in the site.
|
|
|
|
MainSections() []string
|
|
|
|
|
2022-04-21 04:59:13 -04:00
|
|
|
// Returns the Params configured for this site.
|
2019-11-21 15:59:38 -05:00
|
|
|
Params() maps.Params
|
2022-04-21 04:59:13 -04:00
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
// Param is a convenience method to do lookups in Params.
|
|
|
|
Param(key any) (any, error)
|
|
|
|
|
2022-04-21 04:59:13 -04:00
|
|
|
// Returns a map of all the data inside /data.
|
2022-03-17 17:03:27 -04:00
|
|
|
Data() map[string]any
|
2023-01-24 14:57:15 -05:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
// Returns the site config.
|
|
|
|
Config() SiteConfig
|
|
|
|
|
2023-01-24 14:57:15 -05:00
|
|
|
// Returns the identity of this site.
|
2023-01-04 12:24:36 -05:00
|
|
|
// This is for internal use only.
|
2023-01-24 14:57:15 -05:00
|
|
|
GetIdentity() identity.Identity
|
2023-01-04 12:24:36 -05:00
|
|
|
|
|
|
|
// Author is deprecated and will be removed in a future release.
|
|
|
|
Author() map[string]interface{}
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
// Authors is deprecated and will be removed in a future release.
|
|
|
|
Authors() AuthorList
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
// Returns the social links for this site.
|
|
|
|
Social() map[string]string
|
|
|
|
|
|
|
|
// Deprecated: Use Config().Services.GoogleAnalytics instead.
|
|
|
|
GoogleAnalytics() string
|
|
|
|
|
|
|
|
// Deprecated: Use Config().Privacy.Disqus instead.
|
|
|
|
DisqusShortname() string
|
|
|
|
|
|
|
|
// For internal use only.
|
|
|
|
GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error)
|
2023-05-17 03:59:57 -04:00
|
|
|
|
2023-05-18 05:05:56 -04:00
|
|
|
// BuildDrafts is deprecated and will be removed in a future release.
|
2023-05-17 03:59:57 -04:00
|
|
|
BuildDrafts() bool
|
|
|
|
|
2023-05-18 05:05:56 -04:00
|
|
|
// IsMultiLingual reports whether this site is configured with more than one language.
|
2023-05-17 03:59:57 -04:00
|
|
|
IsMultiLingual() bool
|
2023-05-17 17:27:40 -04:00
|
|
|
|
2023-05-18 05:05:56 -04:00
|
|
|
// LanguagePrefix returns the language prefix for this site.
|
2023-05-17 17:27:40 -04:00
|
|
|
LanguagePrefix() string
|
2023-06-14 06:04:32 -04:00
|
|
|
|
|
|
|
// Deprecated. Use site.Home.OutputFormats.Get "rss" instead.
|
|
|
|
RSSLink() template.URL
|
2019-01-02 06:33:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Sites represents an ordered list of sites (languages).
|
|
|
|
type Sites []Site
|
|
|
|
|
|
|
|
// First is a convenience method to get the first Site, i.e. the main language.
|
|
|
|
func (s Sites) First() Site {
|
|
|
|
if len(s) == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return s[0]
|
2017-08-17 04:24:17 -04:00
|
|
|
}
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
type siteWrapper struct {
|
|
|
|
s Site
|
|
|
|
}
|
|
|
|
|
|
|
|
func WrapSite(s Site) Site {
|
|
|
|
if s == nil {
|
|
|
|
panic("Site is nil")
|
|
|
|
}
|
|
|
|
return &siteWrapper{s: s}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Social() map[string]string {
|
|
|
|
return s.s.Social()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Author() map[string]interface{} {
|
|
|
|
return s.s.Author()
|
|
|
|
}
|
2023-05-17 03:59:57 -04:00
|
|
|
func (s *siteWrapper) Authors() AuthorList {
|
|
|
|
return AuthorList{}
|
|
|
|
}
|
2023-01-04 12:24:36 -05:00
|
|
|
|
2023-10-16 14:31:09 -04:00
|
|
|
// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) GoogleAnalytics() string {
|
|
|
|
return s.s.GoogleAnalytics()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) GetPage(ref ...string) (Page, error) {
|
|
|
|
return s.s.GetPage(ref...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Language() *langs.Language {
|
|
|
|
return s.s.Language()
|
|
|
|
}
|
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
func (s *siteWrapper) Languages() langs.Languages {
|
|
|
|
return s.s.Languages()
|
|
|
|
}
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
func (s *siteWrapper) AllPages() Pages {
|
|
|
|
return s.s.AllPages()
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) RegularPages() Pages {
|
|
|
|
return s.s.RegularPages()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Pages() Pages {
|
|
|
|
return s.s.Pages()
|
|
|
|
}
|
|
|
|
|
2023-05-16 12:53:34 -04:00
|
|
|
func (s *siteWrapper) Sections() Pages {
|
|
|
|
return s.s.Sections()
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) Home() Page {
|
|
|
|
return s.s.Home()
|
|
|
|
}
|
|
|
|
|
2023-09-29 13:23:08 -04:00
|
|
|
// Deprecated: use hugo.IsServer instead
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) IsServer() bool {
|
|
|
|
return s.s.IsServer()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) ServerPort() int {
|
|
|
|
return s.s.ServerPort()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Title() string {
|
|
|
|
return s.s.Title()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) LanguageCode() string {
|
|
|
|
return s.s.LanguageCode()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Copyright() string {
|
|
|
|
return s.s.Copyright()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Sites() Sites {
|
|
|
|
return s.s.Sites()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Current() Site {
|
|
|
|
return s.s.Current()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Config() SiteConfig {
|
|
|
|
return s.s.Config()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Hugo() hugo.HugoInfo {
|
|
|
|
return s.s.Hugo()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) BaseURL() template.URL {
|
|
|
|
return s.s.BaseURL()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Taxonomies() TaxonomyList {
|
|
|
|
return s.s.Taxonomies()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) LastChange() time.Time {
|
|
|
|
return s.s.LastChange()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Menus() navigation.Menus {
|
|
|
|
return s.s.Menus()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) MainSections() []string {
|
|
|
|
return s.s.MainSections()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) Params() maps.Params {
|
|
|
|
return s.s.Params()
|
|
|
|
}
|
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
func (s *siteWrapper) Param(key any) (any, error) {
|
|
|
|
return s.s.Param(key)
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) Data() map[string]any {
|
|
|
|
return s.s.Data()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) GetIdentity() identity.Identity {
|
|
|
|
return s.s.GetIdentity()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error) {
|
|
|
|
return s.s.GetPageWithTemplateInfo(info, ref...)
|
|
|
|
}
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
func (s *siteWrapper) BuildDrafts() bool {
|
|
|
|
return s.s.BuildDrafts()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *siteWrapper) IsMultiLingual() bool {
|
|
|
|
return s.s.IsMultiLingual()
|
|
|
|
}
|
|
|
|
|
2023-10-16 13:56:37 -04:00
|
|
|
// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s *siteWrapper) DisqusShortname() string {
|
|
|
|
return s.s.DisqusShortname()
|
|
|
|
}
|
|
|
|
|
2023-05-17 17:27:40 -04:00
|
|
|
func (s *siteWrapper) LanguagePrefix() string {
|
|
|
|
return s.s.LanguagePrefix()
|
|
|
|
}
|
|
|
|
|
2023-06-14 06:04:32 -04:00
|
|
|
func (s *siteWrapper) RSSLink() template.URL {
|
|
|
|
return s.s.RSSLink()
|
|
|
|
}
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
type testSite struct {
|
2023-01-04 12:24:36 -05:00
|
|
|
h hugo.HugoInfo
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
l *langs.Language
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s testSite) Author() map[string]interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
2023-05-17 03:59:57 -04:00
|
|
|
func (s testSite) Authors() AuthorList {
|
|
|
|
return AuthorList{}
|
|
|
|
}
|
2023-01-04 12:24:36 -05:00
|
|
|
|
|
|
|
func (s testSite) Social() map[string]string {
|
|
|
|
return make(map[string]string)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) Hugo() hugo.HugoInfo {
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return t.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) ServerPort() int {
|
|
|
|
return 1313
|
|
|
|
}
|
|
|
|
|
|
|
|
func (testSite) LastChange() (t time.Time) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) Title() string {
|
|
|
|
return "foo"
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (t testSite) LanguageCode() string {
|
|
|
|
return t.l.Lang
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) Copyright() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
func (t testSite) Sites() Sites {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-05-16 12:53:34 -04:00
|
|
|
func (t testSite) Sections() Pages {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (t testSite) GetPage(ref ...string) (Page, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2022-04-05 03:57:58 -04:00
|
|
|
func (t testSite) Current() Site {
|
|
|
|
return t
|
|
|
|
}
|
|
|
|
|
2023-05-17 17:27:40 -04:00
|
|
|
func (s testSite) LanguagePrefix() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
func (t testSite) Languages() langs.Languages {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-10-16 14:31:09 -04:00
|
|
|
// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead
|
2023-01-04 12:24:36 -05:00
|
|
|
func (t testSite) GoogleAnalytics() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) MainSections() []string {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-01-24 14:57:15 -05:00
|
|
|
func (t testSite) GetIdentity() identity.Identity {
|
|
|
|
return identity.KeyValueIdentity{Key: "site", Value: t.l.Lang}
|
|
|
|
}
|
|
|
|
|
2023-09-29 13:23:08 -04:00
|
|
|
// Deprecated: use hugo.IsServer instead
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
func (t testSite) IsServer() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) Language() *langs.Language {
|
|
|
|
return t.l
|
|
|
|
}
|
|
|
|
|
2022-02-17 07:04:00 -05:00
|
|
|
func (t testSite) Home() Page {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
func (t testSite) Pages() Pages {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
func (t testSite) AllPages() Pages {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
func (t testSite) RegularPages() Pages {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) Menus() navigation.Menus {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-12-30 03:20:58 -05:00
|
|
|
func (t testSite) Taxonomies() TaxonomyList {
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (t testSite) BaseURL() template.URL {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2019-11-21 15:59:38 -05:00
|
|
|
func (t testSite) Params() maps.Params {
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-03-17 17:03:27 -04:00
|
|
|
func (t testSite) Data() map[string]any {
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2023-01-04 12:24:36 -05:00
|
|
|
func (s testSite) Config() SiteConfig {
|
|
|
|
return SiteConfig{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (testSite) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2023-10-16 13:56:37 -04:00
|
|
|
// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead
|
2023-01-04 12:24:36 -05:00
|
|
|
func (testSite) DisqusShortname() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2023-05-17 03:59:57 -04:00
|
|
|
func (s testSite) BuildDrafts() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s testSite) IsMultiLingual() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-05-17 07:12:49 -04:00
|
|
|
func (s testSite) Param(key any) (any, error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2023-06-14 06:04:32 -04:00
|
|
|
func (s testSite) RSSLink() template.URL {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
// NewDummyHugoSite creates a new minimal test site.
|
2023-05-20 09:04:22 -04:00
|
|
|
func NewDummyHugoSite(conf config.AllProvider) Site {
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
return testSite{
|
2023-05-20 09:04:22 -04:00
|
|
|
h: hugo.NewInfo(conf, nil),
|
2023-01-04 12:24:36 -05:00
|
|
|
l: &langs.Language{
|
|
|
|
Lang: "en",
|
|
|
|
},
|
Add Hugo Modules
This commit implements Hugo Modules.
This is a broad subject, but some keywords include:
* A new `module` configuration section where you can import almost anything. You can configure both your own file mounts nd the file mounts of the modules you import. This is the new recommended way of configuring what you earlier put in `configDir`, `staticDir` etc. And it also allows you to mount folders in non-Hugo-projects, e.g. the `SCSS` folder in the Bootstrap GitHub project.
* A module consists of a set of mounts to the standard 7 component types in Hugo: `static`, `content`, `layouts`, `data`, `assets`, `i18n`, and `archetypes`. Yes, Theme Components can now include content, which should be very useful, especially in bigger multilingual projects.
* Modules not in your local file cache will be downloaded automatically and even "hot replaced" while the server is running.
* Hugo Modules supports and encourages semver versioned modules, and uses the minimal version selection algorithm to resolve versions.
* A new set of CLI commands are provided to manage all of this: `hugo mod init`, `hugo mod get`, `hugo mod graph`, `hugo mod tidy`, and `hugo mod vendor`.
All of the above is backed by Go Modules.
Fixes #5973
Fixes #5996
Fixes #6010
Fixes #5911
Fixes #5940
Fixes #6074
Fixes #6082
Fixes #6092
2019-05-03 03:16:58 -04:00
|
|
|
}
|
|
|
|
}
|
2023-01-04 12:24:36 -05:00
|
|
|
|
|
|
|
// SiteConfig holds the config in site.Config.
|
|
|
|
type SiteConfig struct {
|
|
|
|
// This contains all privacy related settings that can be used to
|
|
|
|
// make the YouTube template etc. GDPR compliant.
|
|
|
|
Privacy privacy.Config
|
|
|
|
|
|
|
|
// Services contains config for services such as Google Analytics etc.
|
|
|
|
Services services.Config
|
|
|
|
}
|