Skip to content

Clickable categories not working on github pages - only in local quarto preview #953

@jamespeapen

Description

@jamespeapen

I've set up a quarto book on github pages with a category listing: https://jamespeapen.github.io/journals/. The category labels are created and are clickable from the home index.html page, but not from their individual tags in each book page(like on this page) on the github website. But if I use quarto preview locally the tags are clickable. It looks like they have links only with quarto preview:

Github pages:

<div class="quarto-categories">
    <div class="quarto-category">cancer genomics</div>
    <div class="quarto-category">epigenetics</div>
    <div class="quarto-category">intro</div>
  </div>

With quarto-preview:

<div class="quarto-categories">
    <div class="quarto-category"><a href="/index.html#category=cancer%20genomics">cancer genomics</a></div>
    <div class="quarto-category"><a href="/index.html#category=epigenetics">epigenetics</a></div>
    <div class="quarto-category"><a href="/index.html#category=intro">intro</a></div>
</div>

The listings.json file is created by the github action.

Here is the workflow I use:

on:
  push:
    branches: main
  pull_request:
    branches: main
  # to be able to trigger a manual build
  workflow_dispatch:

name: Render and deploy Book

jobs:
  build-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Install Quarto
        uses: quarto-dev/quarto-actions/install-quarto@v1

      - name: Build book
        run: |
          git config --global user.name "${GITHUB_ACTOR}"
          git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
          git checkout -b gh-pages
          quarto render --to html
          git add docs
          cid=$(git rev-parse --short "$GITHUB_SHA")
          git commit -am "Deploy $cid to gh-pages"
          git push origin HEAD:gh-pages --force

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions