yamlhugo

yaml code block in markdown won't generate html with hugo


With the Hugo, I'm trying to generate a site with a code block containing yaml. I am using no special template or any optional stuff. When building the site instead of the codeblock just an

e>

is getting displayed in the HTML. I guess something has gone wrong with the conversion, because there is a flaw in my yaml-code. This is the yaml:

name: Update all wiki articles

on:
  push:
    branches:
      - main
    paths:
      - docs/vimwiki/**

jobs:
  publish:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./docs/vimwiki
    env:
      content: ./wiki/content
    steps:
      - uses: actions/checkout@v4
      - name: Cloning repo
        env:
          # Github personal access token 
          TOKEN: ${{ secrets.WIKI_REPO_TOKEN_RW }}
        run: |
            git config --global user.email "<>"
            git config --global user.name "Github Actions Runner"
            git clone --single-branch --branch main \
              "https://x-access-token:$TOKEN@github.com/hmaier-dev/wiki.git" "wiki"
      - name: Removing old files
        run: |
            find  $content -name '*.md' -type f -exec rm {} \;
            ls -la
      - name: Copy over new files
        run: |
            # Whitelist of all publishable wiki articles
            cp index.md $content
            # more publishable markdown files...
      - name: Setup Python
        uses: actions/setup-python@v3
        with:
          python-version: '3.12'
          
      # Optional:  
      # Give special treatment to index.wiki because it needs to get censored
      - name: Censor index.wiki
        run: |
          cd $content
          python ../build/extract.py index.md
          
      # Pushing to the public wiki
      - name: Commit and push new files
        run: |
            cd wiki
            git checkout main
            git add .
            git diff-index --quiet HEAD || git commit -m "Automatic wiki-publish"
            git push origin main

There is no special output the provided by Hugo. What part in the yaml could fail when building the site? Or is the codeblock just to long?

Thanks for your time.

EDIT: The codeblock is already formatted with yamllint.


Solution

  • By rewriting my article I found out that removing the following comment, from:

          - name: Copy over new files
            run: |
                # Whitelist of all publishable wiki articles
                cp index.md $content
                # more publishable markdown files...
    

    to

          - name: Copy over new files
            run: |
                # Whitelist of all publishable wiki articles
                cp index.md $content
    

    I could get it to work. I suppose the dots (...) at the end of the line where the issue. Can anyone provide some more information regarding this?

    EDIT:

    The dots at the end of the line were not the issue. With the first line

    # How this wiki works
    

    Hugo would treat this as Emcas Org Mode frontmatter.

    When parsing

    # more
    

    Hugo detects a summary divider. Read more about this in the following github-issue: https://github.com/gohugoio/hugo/issues/13152#issuecomment-2544122463