All Projects → statamic → Ssg

statamic / Ssg

The official Statamic 3 static site generator package

Projects that are alternatives of or similar to Ssg

Jigsaw
Simple static sites with Laravel’s Blade.
Stars: ✭ 1,823 (+1603.74%)
Mutual labels:  laravel, static-site-generator
Laracom
Laravel FREE E-Commerce Software
Stars: ✭ 1,570 (+1367.29%)
Mutual labels:  laravel
Startjekyll
An example and guide to getting started with Jekyll and static site generators.
Stars: ✭ 106 (-0.93%)
Mutual labels:  static-site-generator
Leovue
Use the LEO outlining editor to create a Vue.js webapp.
Stars: ✭ 107 (+0%)
Mutual labels:  static-site-generator
Laravel Settings
Store key value pair in database as settings
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Docs.spatie.be Old
Code of docs.spatie.be
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Laravel Amp
Package that helps you set up AMP (Accelerated Mobile Pages) using Laravel
Stars: ✭ 106 (-0.93%)
Mutual labels:  laravel
Awesome Laravel
A curated list of bookmarks, packages, tutorials, videos and other cool resources from the Laravel ecosystem
Stars: ✭ 10,643 (+9846.73%)
Mutual labels:  laravel
Validatorjs
A data validation library in JavaScript for the browser and Node.js, inspired by Laravel's Validator.
Stars: ✭ 1,534 (+1333.64%)
Mutual labels:  laravel
Tableless
O site do Tableless em Hugo. Mais leve, impossível.
Stars: ✭ 107 (+0%)
Mutual labels:  static-site-generator
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-0.93%)
Mutual labels:  laravel
Laravel Tenancy Passport Demo
Laravel demo with Passport and Tenancy
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Llum
Llum (light in catalan language) illuminates your Laravel projects speeding up your Github/Laravel development workflow
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Laravel Deployer
🚀 Zero-downtime deployment out-of-the-box
Stars: ✭ 1,536 (+1335.51%)
Mutual labels:  laravel
Vue Api Query
💎 Elegant and simple way to build requests for REST API
Stars: ✭ 1,528 (+1328.04%)
Mutual labels:  laravel
Openlaravel
A collection of open source projects built using Laravel.
Stars: ✭ 106 (-0.93%)
Mutual labels:  laravel
Vue Laravel Spa
Single Page Application made with Vue.JS2, Vue Router, Vuex and Laravel 5.6.
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Laravel Cacheable
Rinvex Cacheable is a granular, intuitive, and fluent caching system for eloquent models. Simple, but yet powerful, plug-n-play with no hassle.
Stars: ✭ 107 (+0%)
Mutual labels:  laravel
Jekyll
🌐 Jekyll is a blog-aware static site generator in Ruby
Stars: ✭ 43,803 (+40837.38%)
Mutual labels:  static-site-generator
Laravel Excel
🚀 Supercharged Excel exports and imports in Laravel
Stars: ✭ 10,417 (+9635.51%)
Mutual labels:  laravel

Statamic Static Site Generator

Generate static sites with Statamic 3.

Statamic 3.0+

License

No license is required during the Statamic 3 beta period.

Installation

Install the package using Composer:

composer require statamic/ssg

If you want or need to customize the way the site is generated, you can do so by publishing and modifying the config file with the following command:

php artisan vendor:publish --provider="Statamic\StaticSite\ServiceProvider"

The config file will be in config/statamic/ssg.php. This is optional and you can do it anytime.

Usage

Run the following command:

php please ssg:generate

Your site will be generated into a directory which you can deploy however you like. See Deployment Examples below for inspiration.

Routes

Routes will not automatically be generated. You can add any additional URLs you wish to be generated by adding them to the urls array in the config file.

'urls' => [
    '/this-route',
    '/that-route',
],

You can also exclude single routes, or route groups with wildcards. This will override anything in the urls config.

'exclude' => [
    '/secret-page',
    '/cheat-codes/*',
],

Post-generation callback

You may optionally define extra steps to be executed after the site has been generated.

use Statamic\StaticSite\Generator;

class AppServiceProvider extends Provider
{
    public function boot()
    {
        Generator::after(function () {
            // eg. copy directory to some server
        });
    }
}

Deployment Examples

These examples assume your workflow will be to author content locally and not using the control panel in production.

Deploy to Netlify

Deployments are triggered by committing to Git and pushing to GitHub.

  • Create a site in your Netlify account
  • Link the site to your desired GitHub repository
  • Add build command php please ssg:generate
  • Set publish directory storage/app/static
  • Add environment variable: PHP_VERSION 7.4

After your site has an APP_URL...

  • Set it as an environment variable. Add APP_URL https://thats-numberwang-47392.netlify.com

Finally, generate an APP_KEY to your .env file locally using php artisan key:generate and copy it's value, then...

  • Set it as an environment variable. Add APP_KEY [your app key value]

S3 Asset Containers

If you are storing your assets in an S3 bucket, the .envs used will need to be different to the defaults that come with Laravel, as they are reserved by Netlify. For example, you can amend them to the following:

# .env
AWS_S3_ACCESS_KEY_ID=
AWS_S3_SECRET_ACCESS_KEY=
AWS_S3_DEFAULT_REGION=
AWS_S3_BUCKET=
AWS_URL=

Be sure to also update these in your s3 disk configuration:

// config/filesystems.php
's3' => [
    'driver' => 's3',
    'key' => env('AWS_S3_ACCESS_KEY_ID'),
    'secret' => env('AWS_S3_SECRET_ACCESS_KEY'),
    'region' => env('AWS_S3_DEFAULT_REGION'),
    'bucket' => env('AWS_S3_BUCKET'),
    'url' => env('AWS_URL'),
],

Deploy to Vercel

Deployments are triggered by committing to Git and pushing to GitHub.

  • Create a new file called ./build.sh and paste the code snippet below.
  • Run chmod +x build.sh on your terminal to make sure the file can be executed when deploying.
  • Import a new site in your Vercel account
  • Link the site to your desired GitHub repository
  • Add build command ./build.sh
  • Set output directory to storage/app/static
  • Add environment variable in your project settings: APP_KEY <copy & paste from dev>

Code for build.sh

Add the following snippet to build.sh file to install PHP, Composer, and run the ssg:generate command:

#!/bin/sh

# Install PHP & WGET
yum install -y amazon-linux-extras
amazon-linux-extras enable php7.4
yum clean metadata
yum install php php-{common,curl,mbstring,gd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
yum install wget

# INSTALL COMPOSER
EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"

if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
    >&2 echo 'ERROR: Invalid installer checksum'
    rm composer-setup.php
    exit 1
fi

php composer-setup.php --quiet
rm composer-setup.php

# INSTALL COMPOSER DEPENDENCIES
php composer.phar install

# GENERATE APP KEY
php artisan key:generate

# BUILD STATIC SITE
php please ssg:generate

Deploy to Surge

Prerequisite: Install with npm install --global surge. Your first deployment will involve creating an account via command line.

  • Build with command php please ssg:generate
  • Deploy with surge storage/app/static

Deploy to Firebase hosting

Prerequisite: Follow the instructions to get started with Firebase hosting

  • Once hosting is set up, make sure the public config in your firebase.json is set to storage/app/static
  • (Optionally) Add a predeploy config to run php please ssg:generate
  • Run firebase deploy
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].