getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.99k stars 964 forks source link

Confused about deploy on Github Pages #1565

Open HappyClem opened 3 years ago

HappyClem commented 3 years ago

Hello, I am new to this and the issue I have is 100 % my fault but I do not understand how to fix it.

I want to put my Zola folder on github or gitlab pages (let's say github). Should I create a repo and start the procedures in it or should I create the Zola website and then upload it to github ? I tried for several hours yesterday and I am confused with the themes because in the themes folders there is already a .git.

What procedures did I try ?

  1. Create a git repo and then install Zola
    • First I create a repo named "test-zola.github.io"
    • I clone this repo on my computer (Documents\zola-test)
    • I then launch the install process from the repo folder with zola init followed by zola serve Now I have a zola install working with no themes
    • I install a theme ("adidoks") using git clone on the themes folder and adding it in the config file Here is the first confusion, now I have "Documents\zola-test" with .git and config file, and within the "themes" folder I have "adidoks" with also .git and config file

Starting deploy... Fetching themes Submodule 'themes/adidoks' (https://github.com/HappyClem/zola-test.github.io.) registered for path 'themes/adidoks' Cloning into '/github/workspace/themes/adidoks'... fatal: could not read Username for 'https://github.com': No such device or address fatal: clone of 'https://github.com/HappyClem/zola-test.github.io.' into submodule path '/github/workspace/themes/adidoks' failed Failed to clone 'themes/adidoks'. Retry scheduled Cloning into '/github/workspace/themes/adidoks'... fatal: could not read Username for 'https://github.com': No such device or address fatal: clone of 'https://github.com/HappyClem/zola-test.github.io.' into submodule path '/github/workspace/themes/adidoks' failed Failed to clone 'themes/adidoks' a second time, aborting

Note : The website is "as is", I did not create or modify any files except config for the themes. You can check the file I left the test repo up.

Can i have some help ? I hope this is the right place.

coastalwhite commented 3 years ago

I add submodule with Documents\zola-test>git submodule add https://github.com/HappyClem/zola-test.github.io.git themes/adidoks

Shouldn't this be git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks?

HappyClem commented 3 years ago

I add submodule with Documents\zola-test>git submodule add https://github.com/HappyClem/zola-test.github.io.git themes/adidoks

Shouldn't this be git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks?

'themes/adidoks' already exists in the index Does that mean it's okay ? There is a gitignore with "public" in it so there isn't any folder showing up.

coastalwhite commented 3 years ago

I would delete the themes/adidoks folder and run git submodule add https://github.com/aaranxu/adidoks.git themes/adidoks again. Then commit and push.

If you cannot use the zola serve command anymore, run git submodule update --init.

HappyClem commented 3 years ago

@coastalwhite This commands make the actions works ! That's improvement, thanks. In the "pages" tab tho, I got this error Your site is having problems building: The tag import on line 25 in themes/adidoks/content/blog/math-typesetting.md is not a recognized Liquid tag

coastalwhite commented 3 years ago

I think that is more of an issue with aaranxu/adidoks. I would suggest leaving an issue there.

HappyClem commented 3 years ago

I tried with other themes and got others errors ^^'

Error: Failed to render section 'C:\Users\libre-service\Documents\zola-test\content\_index.md' Reason: Failed to render 'index.html' Reason: Variablepaginator.pagesnot found in context while rendering 'index.html'

Keats commented 3 years ago

This error means the theme is expecting paginated content so if you didn't paginate your content you will get this error, details on https://www.getzola.org/documentation/content/section/ on how to set it

HappyClem commented 3 years ago

This error means the theme is expecting paginated content so if you didn't paginate your content you will get this error, details on https://www.getzola.org/documentation/content/section/ on how to set it

I did not do anything apart installing zola yet because I wanted to be able to make it with a friends remotely so modifying it after installing it on github. Do i need to make some content or modification before putting in up ?

Keats commented 3 years ago

Do i need to make some content or modification before putting in up ?

In theory themes should explain in their README what to configure to make them work like https://github.com/getzola/after-dark#installation Maybe try to use one of the themes available from https://github.com/getzola those should be documented although I need to re-test them for 0.14.

matthiasdebernardini commented 2 years ago

I am also struggling to deploy to github pages, this seems like a very useful feature (easy and free blogging) and the documentation is too terse for beginners.

astrale-sharp commented 1 year ago

I'm using this and it works good, careful if you have autogenerated .gitignore, that might fail the cli in weird ways

name: Deploy to Pages

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["main"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: "pages"
  cancel-in-progress: false

# Default to bash
defaults:
  run:
    shell: bash

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    env:
        ZOLA_VERSION: "0.17.2"
    steps:
      - name: Install Zola
        run: |
          set -x
          wget -O - \
            "https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \
          | sudo tar xzf - -C /usr/local/bin          
      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: recursive
      - name: Setup Pages
        id: pages
        uses: actions/configure-pages@v3
      - name: Build with Zola
        run: |
                    zola build
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
        with:
          path: ./public

  # Deployment job
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2
Keats commented 1 year ago

I'm a bit confused about the hard part about deploying to GH. I've followed the docs for all my sites (getzola.org included) and it was easy

matthiasdebernardini commented 1 year ago

was it recently? @Keats

astrale-sharp commented 1 year ago

From memory, I copied my working .yaml from the internet but the official one didn't work, this was already a week ago so not sure if something else was in the way

Keats commented 1 year ago

Yeah it was last month: https://github.com/getzola/zola/commit/4785ab2552998a1afb455fe56e88b73d11c5ead3