2023-01-04 12:24:36 -05:00
|
|
|
# Test the new command.
|
|
|
|
|
|
|
|
hugo new site -h
|
|
|
|
stdout 'Create a new site in the provided directory'
|
2023-06-24 11:45:53 -04:00
|
|
|
hugo new site my-yaml-site --format yml
|
|
|
|
checkfile my-yaml-site/hugo.yml
|
2023-05-27 09:08:11 -04:00
|
|
|
hugo new site mysite -f
|
2023-08-16 18:07:01 -04:00
|
|
|
stdout 'Congratulations! Your new Hugo site was created in'
|
2023-01-04 12:24:36 -05:00
|
|
|
cd mysite
|
2023-08-16 18:07:01 -04:00
|
|
|
checkfile archetypes/default.md
|
2023-01-04 12:24:36 -05:00
|
|
|
checkfile hugo.toml
|
2023-08-16 18:07:01 -04:00
|
|
|
exists assets
|
|
|
|
exists content
|
|
|
|
exists data
|
|
|
|
exists i18n
|
|
|
|
exists layouts
|
|
|
|
exists static
|
|
|
|
exists themes
|
2023-08-23 15:53:46 -04:00
|
|
|
! exists resources
|
2023-01-04 12:24:36 -05:00
|
|
|
|
|
|
|
hugo new theme -h
|
2023-06-28 03:30:27 -04:00
|
|
|
stdout 'Create a new theme \(skeleton\) called \[name\] in ./themes'
|
2023-01-04 12:24:36 -05:00
|
|
|
hugo new theme mytheme
|
2023-08-16 18:07:01 -04:00
|
|
|
stdout 'Creating new theme'
|
2023-08-23 15:53:46 -04:00
|
|
|
! exists resources
|
2023-01-04 12:24:36 -05:00
|
|
|
cd themes
|
|
|
|
cd mytheme
|
2023-08-16 18:07:01 -04:00
|
|
|
checkfile archetypes/default.md
|
|
|
|
checkfile assets/css/main.css
|
|
|
|
checkfile assets/js/main.js
|
|
|
|
checkfile content/_index.md
|
|
|
|
checkfile content/posts/_index.md
|
|
|
|
checkfile content/posts/post-1.md
|
|
|
|
checkfile content/posts/post-2.md
|
|
|
|
checkfile content/posts/post-3/bryce-canyon.jpg
|
|
|
|
checkfile content/posts/post-3/index.md
|
|
|
|
checkfile layouts/_default/baseof.html
|
|
|
|
checkfile layouts/_default/home.html
|
|
|
|
checkfile layouts/_default/list.html
|
|
|
|
checkfile layouts/_default/single.html
|
|
|
|
checkfile layouts/partials/footer.html
|
|
|
|
checkfile layouts/partials/head.html
|
|
|
|
checkfile layouts/partials/head/css.html
|
|
|
|
checkfile layouts/partials/head/js.html
|
|
|
|
checkfile layouts/partials/header.html
|
|
|
|
checkfile layouts/partials/menu.html
|
|
|
|
checkfile layouts/partials/terms.html
|
|
|
|
checkfile static/favicon.ico
|
|
|
|
checkfile LICENSE
|
|
|
|
checkfile README.md
|
2023-08-23 09:33:37 -04:00
|
|
|
checkfile hugo.toml
|
2023-01-04 12:24:36 -05:00
|
|
|
checkfile theme.toml
|
2023-08-16 18:07:01 -04:00
|
|
|
exists data
|
|
|
|
exists i18n
|
2023-01-04 12:24:36 -05:00
|
|
|
|
|
|
|
cd $WORK/mysite
|
|
|
|
|
|
|
|
hugo new -h
|
|
|
|
stdout 'Create a new content file.'
|
|
|
|
hugo new posts/my-first-post.md
|
|
|
|
checkfile content/posts/my-first-post.md
|
|
|
|
|
2023-05-28 04:44:40 -04:00
|
|
|
cd ..
|
|
|
|
cd myexistingsite
|
|
|
|
hugo new post/foo.md -t mytheme
|
|
|
|
grep 'Dummy content' content/post/foo.md
|
|
|
|
|
2024-10-15 13:05:06 -04:00
|
|
|
cd $WORK
|
|
|
|
|
|
|
|
# In the three archetype format tests below, skip Windows testing to avoid
|
|
|
|
# newline differences when comparing to golden.
|
|
|
|
|
|
|
|
hugo new site json-site --format json
|
|
|
|
[!windows] cmp json-site/archetypes/default.md archetype-golden-json.md
|
|
|
|
|
|
|
|
hugo new site toml-site --format toml
|
|
|
|
[!windows] cmp toml-site/archetypes/default.md archetype-golden-toml.md
|
|
|
|
|
|
|
|
hugo new site yaml-site --format yaml
|
|
|
|
[!windows] cmp yaml-site/archetypes/default.md archetype-golden-yaml.md
|
|
|
|
|
2023-05-28 04:44:40 -04:00
|
|
|
-- myexistingsite/hugo.toml --
|
|
|
|
theme = "mytheme"
|
|
|
|
-- myexistingsite/content/p1.md --
|
|
|
|
---
|
|
|
|
title: "P1"
|
|
|
|
---
|
|
|
|
-- myexistingsite/themes/mytheme/hugo.toml --
|
|
|
|
-- myexistingsite/themes/mytheme/archetypes/post.md --
|
|
|
|
---
|
|
|
|
title: "{{ replace .Name "-" " " | title }}"
|
|
|
|
date: {{ .Date }}
|
|
|
|
draft: true
|
|
|
|
---
|
|
|
|
|
|
|
|
Dummy content.
|
2024-10-15 13:05:06 -04:00
|
|
|
|
|
|
|
-- archetype-golden-json.md --
|
|
|
|
{
|
|
|
|
"date": "{{ .Date }}",
|
|
|
|
"draft": true,
|
|
|
|
"title": "{{ replace .File.ContentBaseName \"-\" \" \" | title }}"
|
|
|
|
}
|
|
|
|
-- archetype-golden-toml.md --
|
|
|
|
+++
|
|
|
|
date = '{{ .Date }}'
|
|
|
|
draft = true
|
|
|
|
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
|
|
|
+++
|
|
|
|
-- archetype-golden-yaml.md --
|
|
|
|
---
|
|
|
|
date: '{{ .Date }}'
|
|
|
|
draft: true
|
|
|
|
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
|
|
|
|
---
|