Skip to content

Commit

Permalink
Merge pull request hexojs#1092 from SukkaW/full_url_for-docs
Browse files Browse the repository at this point in the history
docs(helper): add full_url_for
  • Loading branch information
SukkaW authored Oct 16, 2019
2 parents 025fb15 + 1b6c7a6 commit 8448996
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions source/docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ Returns the relative URL from `from` to `to`.
<%- relative_url(from, to) %>
```

### full_url_for

Returns a url with the `config.url` prefixed. Output is encoded automatically.

``` js
<%- full_url_for(path) %>
```

**Examples:**

``` yml
_config.yml
url: https://example.com/blog # example
```
``` js
<%- full_url_for('/a/path') %>
// https://example.com/blog/a/path
```

### gravatar

Inserts a Gravatar image.
Expand Down
20 changes: 20 additions & 0 deletions source/zh-cn/docs/helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@ title: 辅助函数(Helpers)
// https://www.gravatar.com/avatar/b9b00e66c6b8a70f88c73cb6bdb06787?s=40&d=https%3A%2F%2Fvia.placeholder.com%2F150
```

### full_url_for

在路径前加上根路径和域名。输出会被自动转码。

``` js
<%- full_url_for(path) %>
```

**示例:**

``` yml
_config.yml
url: https://example.com/blog # example
```
``` js
<%- full_url_for('/a/path') %>
// https://example.com/blog/a/path
```

## HTML 标签

### css
Expand Down

0 comments on commit 8448996

Please sign in to comment.