| 1 |
# Test the hugo server command. |
| 2 |
|
| 3 |
# We run these tests in parallel so let Hugo decide which port to use. |
| 4 |
hugo server --renderToMemory --gc & |
| 5 |
|
| 6 |
waitServer |
| 7 |
|
| 8 |
httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0 'ServerPort: \d{4,5}' 'myenv: thedevelopment' 'livereload\.js' 'Env: development' 'IsServer: true' |
| 9 |
httpget ${HUGOTEST_BASEURL_0}doesnotexist 'custom 404' |
| 10 |
httpget ${HUGOTEST_BASEURL_0}livereload.js 'function' |
| 11 |
|
| 12 |
# By default, the server renders to memory. |
| 13 |
! exists public/index.html |
| 14 |
|
| 15 |
stopServer |
| 16 |
! stderr . |
| 17 |
|
| 18 |
-- hugo.toml -- |
| 19 |
title = "Hugo Server Test" |
| 20 |
baseURL = "https://example.org/" |
| 21 |
disableKinds = ["taxonomy", "term", "sitemap"] |
| 22 |
-- config/production/params.toml -- |
| 23 |
myenv = "theproduction" |
| 24 |
-- config/development/params.toml -- |
| 25 |
myenv = "thedevelopment" |
| 26 |
-- layouts/home.html -- |
| 27 |
<!DOCTYPE html> |
| 28 |
<body> |
| 29 |
Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|ServerPort: {{ site.ServerPort }}|myenv: {{ .Site.Params.myenv }}|Env: {{ hugo.Environment }}|IsServer: {{ hugo.IsServer }}| |
| 30 |
</body> |
| 31 |
-- layouts/404.html -- |
| 32 |
custom 404 |