Permalink
Browse files

add param height for codepen shortcode

  • Loading branch information...
tatthien committed Jan 3, 2019
1 parent 016c90c commit 99c96b19aed39c6cb6eb74453cfee13542e3c835
Showing with 9 additions and 5 deletions.
  1. +4 −4 content/pages/shortcodes.md
  2. +5 −1 themes/blog/layouts/shortcodes/codepen.html
@@ -22,16 +22,16 @@ Bên cạnh những [shortcode đã được tích hợp sẵn](https://gohugo.i
## codepen

```
{{</* codepen username pen_id */>}}
{{</* codepen username pen_id height_in_px */>}}
```

Ví dụ
Nếu không set giá trị `height` thì `height` mặc định sẽ là 500px. Ví dụ:

```
{{</* codepen tatthien LgMKpm */>}}
{{</* codepen tatthien LgMKpm 400 */>}}
```

{{<codepen tatthien LgMKpm>}}
{{<codepen tatthien LgMKpm 400>}}

## alert

@@ -1,6 +1,10 @@
{{ $height := 500 }}
{{ if isset .Params 2 }}
{{ $height = .Get 2 }}
{{ end }}
<p>
<iframe
height='500'
height='{{ $height }}'
scrolling='no'
src='//codepen.io/{{ index .Params 0 }}/embed/{{ index .Params 1 }}/?height=265&theme-id=dark&default-tab=result'
frameborder='no'

0 comments on commit 99c96b1

Please sign in to comment.