mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 12:36:16 -04:00
docs: Fix incorrectly escaped template example (#27)
This commit is contained in:
parent
cca0660339
commit
167fe7079f
1 changed files with 2 additions and 4 deletions
|
@ -77,8 +77,6 @@ Save your Caddyfile, then refresh your browser tab. You should either see a list
|
||||||
|
|
||||||
Let's do something interesting with our file server: serve a templated page. Create a new file and paste this into it:
|
Let's do something interesting with our file server: serve a templated page. Create a new file and paste this into it:
|
||||||
|
|
||||||
<!-- We use zero-width space character () to trick templates into not evaluating in this tutorial. -->
|
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
@ -86,7 +84,7 @@ Let's do something interesting with our file server: serve a templated page. Cre
|
||||||
<title>Caddy tutorial</title>
|
<title>Caddy tutorial</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}}
|
Page loaded at: {{`{{`}}now | date "Mon Jan 2 15:04:05 MST 2006"{{`}}`}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
@ -96,7 +94,7 @@ Save this as `caddy.html` in the current directory and load it in your browser:
|
||||||
The output is:
|
The output is:
|
||||||
|
|
||||||
```
|
```
|
||||||
Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}}
|
Page loaded at: {{`{{`}}now | date "Mon Jan 2 15:04:05 MST 2006"{{`}}`}}
|
||||||
```
|
```
|
||||||
|
|
||||||
Wait a minute. We should see today's date. Why didn't it work? It's because the server hasn't yet been configured to evaluate templates! Easy to fix, just add a line to the Caddyfile so it looks like this:
|
Wait a minute. We should see today's date. Why didn't it work? It's because the server hasn't yet been configured to evaluate templates! Easy to fix, just add a line to the Caddyfile so it looks like this:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue