lavas-project / jekyll-pwa

Jekyll plugin for PWA
MIT License
107 stars 19 forks source link

undefined local variable or method `page' for Jekyll:Module #38

Closed datapolitical closed 3 years ago

datapolitical commented 3 years ago

I've configured the plugin exactly as laid out in the README.md and I'm getting the error above. Site works fine when I disable it.

Here's my _config.yml

# Setup
title:            Chris F. Nicholson
tagline:          'A place for the things I enjoy.'
description:      'Recipes and some writings by Chris F. Nicholson'
url:              https://www.chrisfnicholson.com
baseurl:          ''
                  # the optional subpath of your site, e.g. "/blog"
                  # NB: This applies to all pages in your Jekyll site.
                  # If you want to move just the blog index pages but keep
                  # other pages at root, see the paginate_path and
                  # sidebar_blog_link below.

author:
  name:           'Chris F. Nicholson'
  url:            https://www.chrisfnicholson.com

paginate:         5
# paginate_path:    '/page:num'
                    # Or '/blog/page:num' if you want to move your index pages

# Layout

show_social: false          # show site description and social links in the footer
show_excerpts: false       # show article excerpts on the home page
show_frame: false          # adds a gray frame to the site
sidebar: false        # show a sidebar instead of the usual header

# Theme
style: default
# dark_theme: true
# dark_nav: true

# Menu
navigation:
  - {title: Home, file: "index.html", icon: home}
  - {title: Recipes, url: "/recipes", icon: utensils}
  - {title: Cocktails, url: "/drinks", icon: glass-martini}

plugins:
  - jekyll-feed
  - jekyll-gist
  - jekyll-paginate
  - jekyll-remote-theme
  - jekyll-datapage-generator
  - jekyll-responsive-image
  - jekyll-webp
  - jekyll-sitemap
  - jekyll-seo-tag
  - Jekyll-pwa-plugin

exclude:
  - Gemfile
  - Gemfile.lock
  - Makefile
  - README.md
  - .gitignore
  - vendor

remote_theme: niklasbuschmann/contrast@v2.10

page_gen:
  - data: recipes
    template: recipe
    name: name
    dir: recipes
    extension: html

  - data: drinks
    template: drink
    name: name
    title: name
    dir: drinks
    extension: html

responsive_image:
  template: _includes/responsive-image.html
  base_path: assets
  sizes:
    - width: 320
    - width: 480
    - width: 800

pwa:
  enabled: true # Optional
  sw_src_filepath: service-worker.js # Optional
  sw_dest_filename: service-worker.js # Optional
  dest_js_directory: /js # Required
  precache_recent_posts_num: 5 # Optional
  precache_glob_directory: / # Optional
  precache_glob_patterns: # Optional
    - "{js,css,fonts}/**/*.{js,css,eot,svg,ttf,woff}"
    - index.html
    - "recipes/*"
  precache_glob_ignores: # Optional
    - sw-register.js
    - "fonts/**/*"

# google_analytics: G-QTJ2YPCJSC
google_analytics: UA-387663-5

############################################################
# Site configuration for the WebP Generator Plugin
# The values here represent the defaults if nothing is set
webp:
  enabled: true

  # The quality of the webp conversion 0 to 100 (where 100 is least lossy)
  quality: 75

  # List of directories containing images to optimize, nested directories will only be checked if `nested` is true
  # By default the generator will search for a folder called `/img` under the site root and process all jpg, png and tiff image files found there.
  img_dir: ["assets/images/recipes", "assets/images/drinks"]

  # Whether to search in nested directories or not
  nested: no

  # add ".gif" to the format list to generate webp for animated gifs as well
  formats: [".jpeg", ".jpg", ".png", ".tiff"]

  # File extensions for animated gif files
  gifs: [".gif"]

  # Set to true to always regenerate existing webp files
  regenerate: false

  # Local path to the WebP utilities to use (relative or absolute)
  # Omit or leave as nil to use the utilities shipped with the gem, override only to use your local install
  webp_path: nil

  # List of files or directories to exclude
  # e.g. custom or hand generated webp conversion files
  exclude: []

  # append '.webp' to filename after original extension rather than replacing it.
  # Default transforms `image.png` to `image.webp`, while changing to true transforms `image.png` to `image.png.webp`
  append_ext: false
############################################################
ngocsangyem commented 3 years ago

I have the same problem.

datapolitical commented 3 years ago

@ngocsangyem Use jekyll-pwa-workbox

ngocsangyem commented 3 years ago

Thanks @datapolitical , It's work.