Skip to content

Commit

Permalink
docs: document the repository widget
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Sep 9, 2022
1 parent d3f7bae commit a277de5
Show file tree
Hide file tree
Showing 7 changed files with 183 additions and 0 deletions.
Expand Up @@ -154,5 +154,6 @@ The site parameters are located in `config/_default/params.toml` by default.
| `feeds.content` | Boolean | `false` | Display the full content if ebabled.
| `actionsPanel` | Object | - |
| `actionsPanel.disabled` | Boolean | `false` | Disable actions panel.
| `repo` | Object | - | See [Repository widget]({{< ref "docs/widgets/repository" >}}).

> Except the Google webmaster tool, the other webmaster tools cannot work with `hugo --minify`, because they cannot recognize the minified meta tag.
Expand Up @@ -157,5 +157,6 @@ authors = ["RazonYang"]
| `feeds.content` | Boolean | `false` | Display the full content if ebabled.
| `actionsPanel` | Object | - |
| `actionsPanel.disabled` | Boolean | `false` | 禁用 actions panel。
| `repo` | Object | - | See [Repository widget]({{< ref "docs/widgets/repository" >}}).

> 除了 Google 站长工具外,其他搜索引擎站长工具无法与 `hugo --minify` 同时使用,这是因为它们无法识别优化后的元标签。
Expand Up @@ -157,5 +157,6 @@ authors = ["RazonYang"]
| `feeds.content` | Boolean | `false` | Display the full content if ebabled.
| `actionsPanel` | Object | - |
| `actionsPanel.disabled` | Boolean | `false` | 禁用 actions panel。
| `repo` | Object | - | See [Repository widget]({{< ref "docs/widgets/repository" >}}).

> 除了 Google 站長工具外,其他搜索引擎站長工具無法與 `hugo --minify` 同時使用,這是因為它們無法識別優化後的元標簽。
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions exampleSite/content/docs/widgets/repository/index.md
@@ -0,0 +1,60 @@
+++
# type = "docs"
title = "Repository Widget"
date = 2022-09-09T21:06:19+08:00
# description = "" # Used by description meta tag, summary will be used instead if not set or empty.
featured = false
draft = false
comment = true
toc = true
reward = true
pinned = false
carousel = false
categories = ["Widget"]
tags = ["Repository", "GitHub"]
series = ["Docs"]
images = []
authors = ["RazonYang"]
+++

The repository widget shows the commit information about current page, it's useful for users to view or edit the source code.

<!--more-->

## Requirements

This widget relies on the [.GitInfo](https://gohugo.io/variables/git/), so you'll need to either enable it via the `--enableGitInfo` flag or setting the `enableGitInfo` as `true` in `config.toml`.

```bash
$ hugo --enableGitInfo
```

```toml {title="config.toml"}
enableGitInfo = true
```

## Site Parameters

| Name | Type | Default | Description
|---|:-:|:-:|---
| `repo` | Object | - |
| `repo.url` | String | - | Required. The URL of your public repository. GitHub and GitLab are supported.
| `repo.branch` | String | `master` | The branch name.
| `repo.subPath` | String | - | The sub path of content.
| `repo.dateFormat` | String | `02/01/2006, 15:04:05 PM` | The format of commit date.

## Usage

The repository widget is disabled by default, you'll need to include widget via [Hooks]({{< ref "docs/advanced/hooks" >}}).

For `posts` layout.

```html {title="layouts/partials/hooks/sidebar-end.html"}
{{- partial "docs/repo" . }}
```

For `docs` layout.

```html {title="layouts/partials/hooks/docs/sidebar-end.html"}
{{- partial "docs/repo" . }}
```
60 changes: 60 additions & 0 deletions exampleSite/content/docs/widgets/repository/index.zh-hans.md
@@ -0,0 +1,60 @@
+++
# type = "docs"
title = "Repository Widget"
date = 2022-09-09T21:06:19+08:00
# description = "" # Used by description meta tag, summary will be used instead if not set or empty.
featured = false
draft = false
comment = true
toc = true
reward = true
pinned = false
carousel = false
categories = ["Widget"]
tags = ["Repository", "GitHub"]
series = ["文档"]
images = []
authors = ["RazonYang"]
+++

The repository widget shows the commit information about current page, it's useful for users to view or edit the source code.

<!--more-->

## Requirements

This widget relies on the [.GitInfo](https://gohugo.io/variables/git/), so you'll need to either enable it via the `--enableGitInfo` flag or setting the `enableGitInfo` as `true` in `config.toml`.

```bash
$ hugo --enableGitInfo
```

```toml {title="config.toml"}
enableGitInfo = true
```

## Site Parameters

| Name | Type | Default | Description
|---|:-:|:-:|---
| `repo` | Object | - |
| `repo.url` | String | - | Required. The URL of your public repository. GitHub and GitLab are supported.
| `repo.branch` | String | `master` | The branch name.
| `repo.subPath` | String | - | The sub path of content.
| `repo.dateFormat` | String | `02/01/2006, 15:04:05 PM` | The format of commit date.

## Usage

The repository widget is disabled by default, you'll need to include widget via [Hooks]({{< ref "docs/advanced/hooks" >}}).

For `posts` layout.

```html {title="layouts/partials/hooks/sidebar-end.html"}
{{- partial "docs/repo" . }}
```

For `docs` layout.

```html {title="layouts/partials/hooks/docs/sidebar-end.html"}
{{- partial "docs/repo" . }}
```
60 changes: 60 additions & 0 deletions exampleSite/content/docs/widgets/repository/index.zh-hant.md
@@ -0,0 +1,60 @@
+++
# type = "docs"
title = "Repository Widget"
date = 2022-09-09T21:06:19+08:00
# description = "" # Used by description meta tag, summary will be used instead if not set or empty.
featured = false
draft = false
comment = true
toc = true
reward = true
pinned = false
carousel = false
categories = ["Widget"]
tags = ["Repository", "GitHub"]
series = ["文檔"]
images = []
authors = ["RazonYang"]
+++

The repository widget shows the commit information about current page, it's useful for users to view or edit the source code.

<!--more-->

## Requirements

This widget relies on the [.GitInfo](https://gohugo.io/variables/git/), so you'll need to either enable it via the `--enableGitInfo` flag or setting the `enableGitInfo` as `true` in `config.toml`.

```bash
$ hugo --enableGitInfo
```

```toml {title="config.toml"}
enableGitInfo = true
```

## Site Parameters

| Name | Type | Default | Description
|---|:-:|:-:|---
| `repo` | Object | - |
| `repo.url` | String | - | Required. The URL of your public repository. GitHub and GitLab are supported.
| `repo.branch` | String | `master` | The branch name.
| `repo.subPath` | String | - | The sub path of content.
| `repo.dateFormat` | String | `02/01/2006, 15:04:05 PM` | The format of commit date.

## Usage

The repository widget is disabled by default, you'll need to include widget via [Hooks]({{< ref "docs/advanced/hooks" >}}).

For `posts` layout.

```html {title="layouts/partials/hooks/sidebar-end.html"}
{{- partial "docs/repo" . }}
```

For `docs` layout.

```html {title="layouts/partials/hooks/docs/sidebar-end.html"}
{{- partial "docs/repo" . }}
```

0 comments on commit a277de5

Please sign in to comment.