diff --git a/exampleSite/layouts/shortcodes/code/deployment-github-pages-workflow.html b/exampleSite/content/docs/deployment/github-pages/code/workflow similarity index 71% rename from exampleSite/layouts/shortcodes/code/deployment-github-pages-workflow.html rename to exampleSite/content/docs/deployment/github-pages/code/workflow index a40ed2f8d..7ffabb00f 100644 --- a/exampleSite/layouts/shortcodes/code/deployment-github-pages-workflow.html +++ b/exampleSite/content/docs/deployment/github-pages/code/workflow @@ -1,3 +1,4 @@ +```yml name: GitHub Pages on: push: @@ -7,7 +8,7 @@ contents: write jobs: build-and-deploy: - concurrency: ci-${{ printf "{{" }} github.ref {{ printf "}}" }} + concurrency: ci-${{ github.ref }} runs-on: ubuntu-latest steps: - name: Checkout 🛎️ @@ -25,9 +26,9 @@ uses: actions/cache@v2 with: path: ~/.npm - key: ${{ printf "{{" }} runner.os {{ printf "}}" }}-node-${{ printf "{{" }} hashFiles('**/package-lock.json') {{ printf "}}" }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | - ${{ printf "{{" }} runner.os {{ printf "}}" }}-node- + ${{ runner.os }}-node- - name: Install dependencies run: npm install @@ -44,5 +45,6 @@ - name: Deploy 🚀 uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ printf "{{" }} secrets.GITHUB_TOKEN {{ printf "}}" }} + github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public +``` diff --git a/exampleSite/content/docs/deployment/github-pages/index.md b/exampleSite/content/docs/deployment/github-pages/index.md index 204ade46a..e6e43f46a 100644 --- a/exampleSite/content/docs/deployment/github-pages/index.md +++ b/exampleSite/content/docs/deployment/github-pages/index.md @@ -25,8 +25,6 @@ This article explains how to deploy sites to [GitHub Pages](https://pages.github Create `.github/workflows/gh-pages.yml` in the site root. -```yaml -{{% code/deployment-github-pages-workflow %}} -``` +{{< page-resource-content "code/workflow" >}} > See also [Starter Template GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)。 diff --git a/exampleSite/content/docs/deployment/github-pages/index.zh-hans.md b/exampleSite/content/docs/deployment/github-pages/index.zh-hans.md index 8dd4309fa..dc956bbf8 100644 --- a/exampleSite/content/docs/deployment/github-pages/index.zh-hans.md +++ b/exampleSite/content/docs/deployment/github-pages/index.zh-hans.md @@ -25,8 +25,6 @@ images = [] 于根目录创建 Workflow `.github/workflows/gh-pages.yml`: -```yaml -{{% code/deployment-github-pages-workflow %}} -``` +{{< page-resource-content "code/workflow" >}} > 也可以参考[新手模板的 GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)。 diff --git a/exampleSite/content/docs/deployment/github-pages/index.zh-hant.md b/exampleSite/content/docs/deployment/github-pages/index.zh-hant.md index 6d430246d..bdbae4d28 100644 --- a/exampleSite/content/docs/deployment/github-pages/index.zh-hant.md +++ b/exampleSite/content/docs/deployment/github-pages/index.zh-hant.md @@ -25,8 +25,6 @@ images = [] 於根目錄創建 Workflow `.github/workflows/gh-pages.yml`: -```yaml -{{% code/deployment-github-pages-workflow %}} -``` +{{< page-resource-content "code/workflow" >}} > 也可以參考[新手模板的 GitHub Pages Workflow](https://github.com/razonyang/hugo-theme-bootstrap-skeleton/blob/main/.github/workflows/gh-pages.yml)。 diff --git a/exampleSite/layouts/shortcodes/page-resource-content.html b/exampleSite/layouts/shortcodes/page-resource-content.html new file mode 100644 index 000000000..6a4219acd --- /dev/null +++ b/exampleSite/layouts/shortcodes/page-resource-content.html @@ -0,0 +1,6 @@ +{{- $name := .Get 0 }} +{{- with .Page.Resources.GetMatch $name }} + {{- .Content | $.Page.RenderString }} +{{- else }} + {{- warnf "no such page resource: %s" $name }} +{{- end }}