Skip to content

Commit f316958

Browse files
Sync from Vault: 2025-08-24 16:18:17
1 parent 4ec5c37 commit f316958

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

content/posts/HugoとGitHubでObsidianで書いたメモを公開してみた.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -314,22 +314,5 @@ jobs:
314314
私の設定は以下で公開中です。
315315
[shindys-note/hugo.toml at master · shindy-dev/shindys-note](https://github.com/shindy-dev/shindys-note/blob/master/hugo.toml)
316316

317-
### Google Analyticsについて
318-
`hugo.toml`には以下のようにGoogle Analytics IDを設定できる箇所があります。
319-
```y
320-
[params.analytics.google]
321-
SiteVerificationTag = "$GOOGLE_ANALYTICS_ID"
322-
```
323-
私の場合はIDを公開したくなかったので、以下のように変数として定義し、GitHub ActionsでGitHub Pagesにデプロイする際、Secretsに登録した値で置換するようにしています。`sed`コマンドが置換処理を制御しています。
324-
```yml
325-
- name: Build Hugo site
326-
run: |
327-
sed -i "s/\$GOOGLE_ANALYTICS_ID/${GOOGLE_ANALYTICS_ID}/g" hugo.toml
328-
hugo --minify
329-
env:
330-
GOOGLE_ANALYTICS_ID: ${{ secrets.GOOGLE_ANALYTICS_ID }}
331-
```
332-
[shindys-note/.github/workflows/deploy.yml at master · shindy-dev/shindys-note](https://github.com/shindy-dev/shindys-note/blob/master/.github/workflows/deploy.yml)
333-
334317

335318
***So everyone, enjoy life!***

0 commit comments

Comments
 (0)