# Page Actions

{{< badge
  text="page-actions.js"
  url="https://github.com/ZhenShuo2021/hugo-yore/blob/main/assets/yore/components/page-actions/page-actions.js"
  variant="muted"
  appearance="accent"
  pill=true
>}}
{{< badge
  text="page-actions.html"
  url="https://github.com/ZhenShuo2021/hugo-yore/blob/main/layouts/_partials/page/page-actions.html"
  variant="muted"
  appearance="accent"
  pill=true
>}}

Page actions add a per-page dropdown menu with utilities for sharing and inspecting content.

## Configuration

All keys go under `params` in `hugo.yaml`. `pageShowActions` can also be set per-page in front matter.

| Key | Type | Description |
|---|---|---|
| `pageShowActions` | bool | Show the page actions menu |
| `repoURL` | string | Branch root URL, enables *View Repo Source* |
| `repoSubdir` | string | Path from repo root to Hugo project directory; set when the Hugo project is not at the repo root |

`repoURL` must point to the branch root, not the repository root. For example:

```yaml {title="hugo.yaml"}
params:
  pageShowActions: true
  repoURL: https://github.com/example/my-site/blob/main
  repoSubdir: exampleSite  # omit if Hugo project is at repo root
```

## Actions

Some actions are always available. Others require additional configuration to activate.

| Action | Condition |
|---|---|
| Copy URL | Always present |
| Copy Markdown | Requires `markdown` in page outputs |
| View Source | Requires `markdown` in page outputs |
| View Repo Source | Requires `repoURL` |

Copy Markdown and View Source serve the raw Markdown of the current page. Set the `markdown` output in `hugo.yaml`:

```diff {title="hugo.yaml"}
outputs: # Custom output formats per page type
  home:
    - HTML
    - RSS
    - backlinks
    - knowledge-graph
+   - markdown
  section:
    - HTML
    - RSS
+   - markdown
  page:
    - HTML
+   - markdown
```




## Ancestors of This Page (Auto Generated)



- https://yore.zsl0621.cc/zh-tw/docs/features/index.md

- https://yore.zsl0621.cc/zh-tw/docs/index.md
