2019-01-02 11:33:26 +00:00
|
|
|
// Copyright 2019 The Hugo Authors. All rights reserved.
|
2017-02-18 09:02:12 +00: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.
|
|
|
|
package hugolib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
2019-08-10 19:05:17 +00:00
|
|
|
qt "github.com/frankban/quicktest"
|
2019-01-02 11:33:26 +00:00
|
|
|
"github.com/gohugoio/hugo/resources/page"
|
|
|
|
|
2017-06-13 16:42:45 +00:00
|
|
|
"github.com/gohugoio/hugo/helpers"
|
2017-02-18 09:02:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestDisableKindsNoneDisabled(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
doTestDisableKinds(t)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDisableKindsSomeDisabled(t *testing.T) {
|
|
|
|
t.Parallel()
|
2019-01-02 11:33:26 +00:00
|
|
|
doTestDisableKinds(t, page.KindSection, kind404)
|
2017-02-18 09:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestDisableKindsOneDisabled(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
for _, kind := range allKinds {
|
2019-01-02 11:33:26 +00:00
|
|
|
if kind == page.KindPage {
|
2017-02-19 08:15:30 +00:00
|
|
|
// Turning off regular page generation have some side-effects
|
|
|
|
// not handled by the assertions below (no sections), so
|
|
|
|
// skip that for now.
|
|
|
|
continue
|
|
|
|
}
|
2017-02-18 09:02:12 +00:00
|
|
|
doTestDisableKinds(t, kind)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestDisableKindsAllDisabled(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
doTestDisableKinds(t, allKinds...)
|
|
|
|
}
|
|
|
|
|
|
|
|
func doTestDisableKinds(t *testing.T, disabled ...string) {
|
|
|
|
siteConfigTemplate := `
|
|
|
|
baseURL = "http://example.com/blog"
|
|
|
|
enableRobotsTXT = true
|
|
|
|
disableKinds = %s
|
|
|
|
|
|
|
|
paginate = 1
|
|
|
|
defaultContentLanguage = "en"
|
|
|
|
|
|
|
|
[Taxonomies]
|
|
|
|
tag = "tags"
|
|
|
|
category = "categories"
|
|
|
|
`
|
|
|
|
|
|
|
|
pageTemplate := `---
|
|
|
|
title: "%s"
|
|
|
|
tags:
|
|
|
|
%s
|
|
|
|
categories:
|
|
|
|
- Hugo
|
|
|
|
---
|
|
|
|
# Doc
|
|
|
|
`
|
|
|
|
|
|
|
|
disabledStr := "[]"
|
|
|
|
|
|
|
|
if len(disabled) > 0 {
|
|
|
|
disabledStr = strings.Replace(fmt.Sprintf("%#v", disabled), "[]string{", "[", -1)
|
|
|
|
disabledStr = strings.Replace(disabledStr, "}", "]", -1)
|
|
|
|
}
|
|
|
|
|
|
|
|
siteConfig := fmt.Sprintf(siteConfigTemplate, disabledStr)
|
|
|
|
|
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 07:16:58 +00:00
|
|
|
b := newTestSitesBuilder(t).WithConfigFile("toml", siteConfig)
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
b.WithTemplates(
|
|
|
|
"index.html", "Home|{{ .Title }}|{{ .Content }}",
|
|
|
|
"_default/single.html", "Single|{{ .Title }}|{{ .Content }}",
|
|
|
|
"_default/list.html", "List|{{ .Title }}|{{ .Content }}",
|
|
|
|
"_default/terms.html", "Terms List|{{ .Title }}|{{ .Content }}",
|
|
|
|
"layouts/404.html", "Page Not Found",
|
|
|
|
)
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
b.WithContent(
|
|
|
|
"sect/p1.md", fmt.Sprintf(pageTemplate, "P1", "- tag1"),
|
|
|
|
"categories/_index.md", newTestPage("Category Terms", "2017-01-01", 10),
|
|
|
|
"tags/tag1/_index.md", newTestPage("Tag1 List", "2017-01-01", 10),
|
|
|
|
)
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
b.Build(BuildCfg{})
|
|
|
|
h := b.H
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
assertDisabledKinds(b, h.Sites[0], disabled...)
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
func assertDisabledKinds(b *sitesBuilder, s *Site, disabled ...string) {
|
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
|
|
|
if isDisabled {
|
2019-01-02 11:33:26 +00:00
|
|
|
return len(s.RegularPages()) == 0
|
2017-02-18 09:02:12 +00:00
|
|
|
}
|
2019-01-02 11:33:26 +00:00
|
|
|
return len(s.RegularPages()) > 0
|
|
|
|
}, disabled, page.KindPage, "public/sect/p1/index.html", "Single|P1")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindHome)
|
2017-02-18 09:02:12 +00:00
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindHome, "public/index.html", "Home")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindSection, "sect")
|
2017-02-18 09:02:12 +00:00
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindSection, "public/sect/index.html", "Sects")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindTaxonomy, "tags", "tag1")
|
2017-02-18 09:02:12 +00:00
|
|
|
|
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
|
|
|
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindTaxonomy, "public/tags/tag1/index.html", "Tag1")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindTaxonomyTerm, "tags")
|
2017-02-18 09:02:12 +00:00
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
|
|
|
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindTaxonomyTerm, "public/tags/index.html", "Tags")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindTaxonomyTerm, "categories")
|
2017-02-18 09:02:12 +00:00
|
|
|
|
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
|
|
|
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindTaxonomyTerm, "public/categories/index.html", "Category Terms")
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b,
|
2017-02-18 09:02:12 +00:00
|
|
|
func(isDisabled bool) bool {
|
2019-01-02 11:33:26 +00:00
|
|
|
p := s.getPage(page.KindTaxonomy, "categories", "hugo")
|
2017-02-18 09:02:12 +00:00
|
|
|
if isDisabled {
|
|
|
|
return p == nil
|
|
|
|
}
|
|
|
|
return p != nil
|
|
|
|
|
2019-01-02 11:33:26 +00:00
|
|
|
}, disabled, page.KindTaxonomy, "public/categories/hugo/index.html", "Hugo")
|
2017-02-18 09:02:12 +00:00
|
|
|
// The below have no page in any collection.
|
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 07:16:58 +00:00
|
|
|
assertDisabledKind(b, func(isDisabled bool) bool { return true }, disabled, kindRSS, "public/index.xml", "<link>")
|
|
|
|
assertDisabledKind(b, func(isDisabled bool) bool { return true }, disabled, kindSitemap, "public/sitemap.xml", "sitemap")
|
|
|
|
assertDisabledKind(b, func(isDisabled bool) bool { return true }, disabled, kindRobotsTXT, "public/robots.txt", "User-agent")
|
|
|
|
assertDisabledKind(b, func(isDisabled bool) bool { return true }, disabled, kind404, "public/404.html", "Page Not Found")
|
2017-02-18 09:02:12 +00: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 07:16:58 +00:00
|
|
|
func assertDisabledKind(b *sitesBuilder, kindAssert func(bool) bool, disabled []string, kind, path, matcher string) {
|
2017-02-18 09:02:12 +00:00
|
|
|
isDisabled := stringSliceContains(kind, disabled...)
|
2019-08-10 19:05:17 +00:00
|
|
|
b.Assert(kindAssert(isDisabled), qt.Equals, true)
|
2017-02-18 09:02:12 +00:00
|
|
|
|
|
|
|
if kind == kindRSS && !isDisabled {
|
|
|
|
// If the home page is also disabled, there is not RSS to look for.
|
2019-01-02 11:33:26 +00:00
|
|
|
if stringSliceContains(page.KindHome, disabled...) {
|
2017-02-18 09:02:12 +00:00
|
|
|
isDisabled = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if isDisabled {
|
|
|
|
// Path should not exist
|
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 07:16:58 +00:00
|
|
|
fileExists, err := helpers.Exists(path, b.Fs.Destination)
|
2019-08-10 19:05:17 +00:00
|
|
|
b.Assert(err, qt.IsNil)
|
|
|
|
b.Assert(fileExists, qt.Equals, false)
|
2017-02-18 09:02:12 +00:00
|
|
|
|
|
|
|
} else {
|
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 07:16:58 +00:00
|
|
|
b.AssertFileContent(path, matcher)
|
2017-02-18 09:02:12 +00:00
|
|
|
}
|
|
|
|
}
|