Scarily Simple Static Sites with Jekyll and PowerShell
Jekyll is a static site generator and server.
PowerShell is a dynamic scripting language that works with everything.
PSJekyll is a PowerShell module for managing Jekyll websites.
You can install PSJekyll from the Gallery:
Install-Module PSJekyll -Force -Scope CurrentUser
Then you can import it by name:
Import-Module PSJekyll
$psJekyll.Site
will have any sites beneath the current directory:
# Push into the PSJekyll module, which will have a site
Get-Module PSJekyll | Split-Path | Push-Location
$psJekyll.Site # output the site
You can set a new configuration file by using:
# Ideally, pass all values in within `[Ordered]` hashtables.
# otherwise the file may change more often than expected.
$psJekyll.Site.Config = [Ordered]@{}
You can set site data in almost the same way as you set configuration:
$psJekyll.Site.Data = @{"MyFavoriteNumber"=42}
# This will create a page that will contain a repository list (in a GitHub page)
$psJekyll.Site.Page = "MyPage", "My Content", @{MyMetadata=$true}
You can easily use PSJekyll as a GitHub Action.
This helps you automate updating content and data within a Jekyll site or GitHub Page.
- name: UsePSJekyll
- uses: PowerShellWeb/PSJekyll@main
Using this action will run any *.PSJekyll.ps1
files in your repository.
Any files outputted from this will be checked into the current branch.
PSJekyll ships every build in a container.
To pull down PSJekyll and start your own server, use something like:
# Pull down the latest image
docker pull ghcr.io/powershellweb/psjekyll
# Start the image in an interactive terminal on port 8069.
docker run --interactive --tty --publish 8069:4000 ghcr.io/powershellweb/psjekyll
- New-PSJekyll creates Jekyll sites.
- Start-PSJekyll starts Jekyll servers in a job.
- Stop-PSJekyll stops running Jekyll jobs.