demystifying-dev / 11ty-theme-conversion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

11ty Theme Conversion

Building on Bryan Robinson's Eleventy theme construction tutorial

A step-by-step, pedagogically documented journey building upon Bryan Robinson's excellent May, 2019 Video Tutorial Create an Eleventy (11ty) theme based on a free HTML template as a starting point.

The completed site is apparently to be found in the author's repo brob / clientsite.com

However, we will be adding an essential missing ingredient to the mix, one that Bryan Robinson mentions himself in Three JAMstack movements to watch in 2020:

A DIY movement reinvigorated

The JAMstack is a great place to be a DIYer. Building things yourself is a path to great satisfaction. With little-to-no cost to build and host small applications, the JAMstack is really a no-brainer for a DIY or Indie movement.

The plan

Original

In the introductory Eleventy (11ty) Static HTML Theme Conversion Introduction video kicking off the series, four stages are planned for:

  • Stage 1: Configuration
    • Set up and configure eleventy
    • Set up and configure the base templates for our site content
  • Stage 2: Data conversion
    • From HTML to collections and global data objects
  • Stage 3: Deployment
    • Netlify deployment
    • Use of Netlify forms for user interaction
  • Stage 4: CMS
    • Hook into Netlify CMS (a GitHub based CMS)
    • Create editorial workflow for content managers

Revisited

  • Stage 1: Configuration
    • We'll add Git repositories
      • Local for development
      • Then, in later stages (see Deploy)
        • Staging repo For ease of use we always push to master Then, staging is updated via automation (automatic pull)
        • Production repo For ease of use we always push to master of this repo to publish Then, production is updated via automation (automatic pull)
  • Stage 2: Data conversion
    • Initially no changes
    • Either immediately afterwards, or in a later iteration we use a backend to centralize and expose our structured content for this and multiple apps
  • Stage 3: Deployment
    • Self-hosting, avoiding paywalls and owning our stuff
    • Single-click Node.js server on DigitalOcean
    • Use of bare repos for staging and production automated via git hooks
  • Stage 4: CMS
    • Hook into an open source (not just free) markdown editor
    • Organize content source files
    • Set up editorial workflow for content managers
    • Editing comes with instant preview plus buttons for staging and for publishing
    • Content Workflow Automation

Configuration

Test initial setup

  • Run eleventy: npx eleventy --serve
    % npx eleventy --serve
    Copied 143 files / Wrote 0 files in 1.27 seconds (v0.11.0)
    Watching…
    [Browsersync] Access URLs:
     --------------------------------------
           Local: http://localhost:8080
        External: http://192.168.0.221:8080
     --------------------------------------
              UI: http://localhost:3001
     UI External: http://localhost:3001
     --------------------------------------
    [Browsersync] Serving files from: _site
  • Only ./assets got copied into the output directory because we don't have oour source directory set up yet. To do that we create a ./src directory and copy the page files into it (index, about, etc.)
  • Now everything is running since we left eleventy running in serve mode and it detected and acted upon the file changes
  • Pointing our browser at http://localhost:8080/, we can visualize our homepage just fine
  • See commit feat(eleventy): Set up and configure eleventy
  • We make another commit so as not to track the output dir

Base Template

Reusable Content Template extends base template

Initial layouts/simple extends base and is applied to about page in commit feat(content template): initial content template applied to about page, and will be reused with other similar pages, for example, individual services pages from the services collection (content type, see Collections, below).

About page now sourced in markdown in following commit

Collections

Custom Homepage

Deployment

API Based Contact Page

CMS

See Eleventy (11ty) Static Sites Part 3: Using NetlifyCMS

Automation

About


Languages

Language:HTML 53.7%Language:Sass 34.4%Language:JavaScript 6.3%Language:CSS 5.5%