Hugo Markdown Tip

Tips for typing Hugo Markdown.

Get the last path of the URL

path.Base PATH

{{ path.Base "a/news.html" }} → "news.html"
{{ path.Base "news.html" }} → "news.html"
{{ path.Base "a/b/c" }} → "c"
{{ path.Base "/x/y/z/" }} → "z"

Get Page params

{{< param testparam >}}
{{< param "my.nested.param" >}}

ie conditional comments

{{ "<!--[if lt IE 9]>" | safeHTML }}
   <script src="html5shiv.js"></script>
{{ "<![endif]-->" | safeHTML }}

Write Shortcodes inside code block

```
{{</* shortcode */>}}
```

Write a block of code block

```js
var x = 0;
```
````
```js
var x = 0;
```
````

Folding

Click to toggle code
// This is x
var x = 0;
<details>
<summary>Click to toggle code</summary>

```js
// This is x
var x = 0;
```
</details>

Separating blocks of code in tables

1
2
// This is x
var x = 0;

1
2
// This is y
var y = 0;

```js {linenos=table}
// This is x
var x = 0;
```
` `
```js {linenos=table}
// This is y
var y = 0;
```

Continue! 👍