Jigsaw
AJA • February 3, 2024
laravelJigsaw is a framework for building static sites using Laravel
Requirements
Installation
mkdir jigsaw
cd jigsaw
composer require tightenco/jigsaw
./vendor/bin/jigsaw init blog
./vendor/bin/jigsaw build
Change Laragon virtual host file, by adding /build_local/ for DocumentRoot and Directory.
C:\laragon\etc\apache2\sites-enabled\auto.jigsaw.test.conf
Without SSL
<VirtualHost *:80>
DocumentRoot "C:/laragon/www/jigsaw/build_local/"
ServerName jigsaw.test
ServerAlias *.jigsaw.test
<Directory "C:/laragon/www/jigsaw/build_local/">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
# If you want to use SSL, enable it by going to Menu > Apache > SSL > Enabled
With SSL enable change the Laragon virtual host file by adding build_local/ at ROOT variable.
C:\laragon\etc\apache2\sites-enabled\auto.jigsaw.test.conf
define ROOT "C:/laragon/www/jigsaw/build_local/"
define SITE "labenoite.test"
<VirtualHost *:80>
DocumentRoot "${ROOT}"
ServerName ${SITE}
ServerAlias *.${SITE}
<Directory "${ROOT}">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "${ROOT}"
ServerName ${SITE}
ServerAlias *.${SITE}
<Directory "${ROOT}">
AllowOverride All
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile C:/laragon/etc/ssl/laragon.crt
SSLCertificateKeyFile C:/laragon/etc/ssl/laragon.key
</VirtualHost>
When you'd like to generate your site, run the build command from within your project root:
./vendor/bin/jigsaw build
Configuration
Change the config.php file with adding siteName, siteDescription and siteAuthor.
return [
'baseUrl' => '',
'production' => false,
'siteName' => 'La benoite',
'siteDescription' => 'Le blog de La Benoite',
'siteAuthor' => 'AJ',
// collections
'collections' => [
'posts' => [
'author' => 'AJ', // Default author, if not provided in a post
'sort' => '-date',
'path' => 'blog/{filename}',
Production
Change the config.production.php file with adding baseUrl.
<?php
return [
'baseUrl' => 'https://jigsaw.com',
'production' => true,
];
When you'd like to generate your site, run the build command from within your project root:
./vendor/bin/jigsaw build production
SFTP
I use Visual Studio Code a lightweight source code editor which is available for Windows.
I use SFTP to sync the build_production folder to my OVH dir.
Ctrl+Shift+P to access SFTP config and change sftp.json with :
{
"name": "ftp.cluster003.hosting.ovh.net",
"host": "ftp.cluster003.hosting.ovh.net",
"protocol": "sftp",
"port": 22,
"username": "OVH identity",
"password": "OVH paswword",
"context": "build_production",
"remotePath": "OVH www dir",
"uploadOnSave": true
}
To sync with OVH do a right click on build_production folder and Sync Local -> Remote.
Remove posts
Remove jigsaw specific posts in _posts folder.
- customizing-your-site
- fuse-search
- getting-started
- my-first-blog-post