### Parklife Configuration Example Source: https://github.com/benpickles/parklife/blob/main/README.md This example Parkfile configures the application, specifying routes to be crawled or explicitly included. It assumes your Rack app is in `./app.rb`. ```ruby # Assuming your Rack app lives in ./app.rb: require_relative 'app' Parkfile.application.routes do # Start from the homepage and crawl all links. root crawl: true # Some extra paths that aren't discovered while crawling. get '/feed.atom' get '/sitemap.xml' # A couple more hidden pages. get '/easter_egg', crawl: true # Services typically allow a custom 404 page. get '/404.html' end ``` -------------------------------- ### Add Parklife Gem to Gemfile Source: https://github.com/benpickles/parklife/blob/main/README.md Include the Parklife gem in your application's Gemfile to start using its static site generation capabilities. Run `bundle install` after adding this line. ```ruby gem 'parklife' ``` -------------------------------- ### Parklife Build Output Example Source: https://github.com/benpickles/parklife/blob/main/README.md This output shows the file structure of the `build` directory after running `parklife build`, indicating the generated static files ready for deployment. ```bash $ find build -type f build/404.html build/about/index.html build/blog/index.html build/blog/2019/03/07/developers-developers-developers/index.html build/blog/2019/04/21/modern-life-is-rubbish/index.html build/blog/2019/05/15/introducing-parklife/index.html build/easter_egg/index.html build/easter_egg/surprise/index.html build/index.html build/location/index.html build/feed.atom build/sitemap.xml ``` -------------------------------- ### Set Rack Application Source: https://github.com/benpickles/parklife/blob/main/README.md Define the Rack application for Parklife if not using Rails configuration. This is necessary for custom setups or when integrating with non-Rails Rack applications. ```ruby Parklife.application.config.app ``` -------------------------------- ### Initialize Parklife Configuration Source: https://github.com/benpickles/parklife/blob/main/README.md Run this command to generate the initial Parkfile configuration and build script. Use flags like `--rails` or `--sinatra` for framework-specific settings, and `--github-pages` for GitHub Actions integration. ```bash $ bundle exec parklife init ``` -------------------------------- ### List Parklife Routes Source: https://github.com/benpickles/parklife/blob/main/README.md Use this command to list all the routes that Parklife has identified for static site generation, based on your Parkfile configuration. ```bash $ bundle exec parklife routes ``` -------------------------------- ### Configure 404 Handling Source: https://github.com/benpickles/parklife/blob/main/README.md Set how Parklife should handle 404 responses encountered during route fetching. Options include raising an error, skipping the response, or issuing a warning. ```ruby Parklife.application.config.on_404 = :warn ``` -------------------------------- ### Change Build Output Directory Source: https://github.com/benpickles/parklife/blob/main/README.md Specify a custom directory for Parklife's build output. The default directory is 'build' and its contents are cleared before each build. ```ruby Parklife.application.config.build_dir = 'my/build/dir' ``` -------------------------------- ### Set Base URL at Build Time Source: https://github.com/benpickles/parklife/blob/main/README.md Override the Parklife base URL setting when building the site using the command line. This is useful for specific build environments or deployments. ```bash $ bundle exec parklife build --base https://benpickles.github.io/parklife ``` -------------------------------- ### Set Base URL for Full URLs Source: https://github.com/benpickles/parklife/blob/main/README.md Configure the base URL for Parklife to ensure Rails URL helpers generate correct full URLs. This setting can be overridden at build time. ```ruby Parklife.application.config.base = 'https://foo.example.com' ``` -------------------------------- ### Disable Nested Index Files Source: https://github.com/benpickles/parklife/blob/main/README.md Turn off the default behavior of storing routes in nested 'index.html' files. This changes storage to '.html' files, enabling trailing slash-less URLs with services like GitHub Pages or Netlify. ```ruby Parklife.application.config.nested_index = false ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.