|
4 | 4 |
|
5 | 5 | # PSJekyll
|
6 | 6 |
|
7 |
| -Scary Simple Static Sites with PowerShell and Jekyll |
| 7 | +Scarily Simple Static Sites with Jekyll and PowerShell |
8 | 8 |
|
9 | 9 | [Jekyll](https://jekyllrb.com) is a static site generator and server.
|
10 | 10 |
|
11 | 11 | PowerShell is a dynamic scripting language that works with everything.
|
12 | 12 |
|
13 | 13 | PSJekyll is a PowerShell module for managing Jekyll websites.
|
14 | 14 |
|
| 15 | +## PSJekyll Basics |
| 16 | + |
| 17 | +You can install PSJekyll from the Gallery: |
| 18 | + |
| 19 | +~~~PowerShell |
| 20 | +Install-Module PSJekyll -Force -Scope CurrentUser |
| 21 | +~~~ |
| 22 | + |
| 23 | +Then you can import it by name: |
| 24 | + |
| 25 | +~~~PowerShell |
| 26 | +Import-Module PSJekyll |
| 27 | +~~~ |
| 28 | + |
| 29 | +`$psJekyll.Site` will have any sites beneath the current directory: |
| 30 | + |
| 31 | +~~~PowerShell |
| 32 | +# Push into the PSJekyll module, which will have a site |
| 33 | +Get-Module PSJekyll | Split-Path | Push-Location |
| 34 | +$psJekyll.Site # output the site |
| 35 | +~~~ |
| 36 | + |
| 37 | +### Setting configuration |
| 38 | + |
| 39 | +You can set a new configuration file by using: |
| 40 | + |
| 41 | +~~~PowerShell |
| 42 | +# Ideally, pass all values in within `[Ordered]` hashtables. |
| 43 | +# otherwise the file may change more often than expected. |
| 44 | +$psJekyll.Site.Config = [Ordered]@{} |
| 45 | +~~~ |
| 46 | + |
| 47 | +### Setting data |
| 48 | + |
| 49 | +You can set site data in almost the same way as you set configuration: |
| 50 | + |
| 51 | +~~~PowerShell |
| 52 | +$psJekyll.Site.Data = @{"MyFavoriteNumber"=42} |
| 53 | +~~~ |
| 54 | + |
| 55 | + |
| 56 | +### Setting pages |
| 57 | + |
| 58 | +~~~PowerShell |
| 59 | +# This will create a page that will contain a repository list (in a GitHub page) |
| 60 | +$psJekyll.Site.Page = "MyPage", "My Content", @{MyMetadata=$true} |
| 61 | +~~~ |
| 62 | + |
15 | 63 | ## PSJekyll GitHub Action
|
16 | 64 |
|
17 | 65 | You can easily use PSJekyll as a GitHub Action.
|
18 | 66 |
|
19 | 67 | This helps you automate updating content and data within a Jekyll site or GitHub Page.
|
20 | 68 |
|
21 | 69 | ~~~yaml
|
22 |
| -- name: UseEZOut |
| 70 | +- name: UsePSJekyll |
23 | 71 | - uses: PowerShellWeb/PSJekyll@main
|
24 | 72 | ~~~
|
25 | 73 |
|
|
0 commit comments