2017-25 © Pedro Peláez
 

library statie

Static Site Generator

image

symplify/statie

Static Site Generator

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 100 Versions
  • 18 % Grown

The README.md

, (*1)

[DEPRECATED since 2020-03] Statie - Modern and Simple Static Site Generator in PHP

Use Symfony Static Dumper instead

Downloads, (*2)

Statie takes HTML, Markdown and Twig files and generates static HTML page., (*3)

Install

composer require symplify/statie

How to Generate and See the Website?

  1. Prepare content for Statie
vendor/bin/statie init

This will generate config, templates, layouts and gulp code, so you can enjoy live preview., (*4)

Last step is install node dependencies:, (*5)

npm install
  1. Generate static site from /source (argument) to /output (default value) in HTML:
vendor/bin/statie generate source
  1. Run website locally
gulp
  1. And see web in browser localhost:8000.

Do you use Jekyll or Sculpin?

Configuration

statie.yml Config

This is basically Symfony Kernel config.yml that you know from Symfony application. You can:, (*6)

# statie.yml
imports:
    - { resource: 'data/favorite_links.yml' }

parameters:
    site_url: 'http://github.com'
    socials:
        facebook: 'http://facebook.com/github'

services:
    App\SomeService: ~

Parameters are available in every template:, (*7)

{# source/_layouts/default.twig #}



Welcome to: {{ site_url }}, (*8)

Checkout my FB page: {{ socials.facebook }}, (*9)

Do You Write Posts?

Create a new empty .md file with date, webalized title and ID:, (*10)

vendor/bin/statie create-post "My new post"

Statie privides default template:, (*11)

id: __ID__
title: "__TITLE__"
---

Do you want your own template? Configure path to it:, (*12)

# statie.yaml
parameters:
    post_template_path: 'templates/my_own_post.twig'

That's it!, (*13)

How to Generate API?

Statie web Friendsofphp.org provide info about PHP meetups and groups. They're already stored in parameters. Do you want to publish them as JSON API?, (*14)

parameters:
    api_parameters:
        - 'groups'
        - 'meetups'

This will generate 2 pages:, (*15)

/api/groups.json
/api/meetups.json

With parameters as JSON, that anyone can use now., (*16)

How to Redirect old page?

# statie.yml
parameters:
    redirects:
        old_page: 'new_page'
        old_local_page: 'https://external-link.com'

Are you Speaker? Use your JoindIn Talks

# statie.yml
parameters:
    joind_in_username: 'tomasvotruba'
vendor/bin/statie dump-joind-in

This will generated source/_data/generated/joind_in_talks.yaml file with your talks:, (*17)

parameters:
    joind_in_talks:
        # ...

Then you can use them like any other parameter in your Statie templates:, (*18)

{% for joind_in_talk in joind_in_talks %}
    ...
{% endfor %}

Useful Twig Filters

All from this basic set and more:, (*19)

{% set users = sort_by_field(users, 'name') %}
{% set users = sort_by_field(users, 'name', 'desc') %}


{% set relatedPosts = related_items(post)}

{{ content|reading_time }} mins
{{ post.getRawContent|reading_time }} mins

{{ perexDeprecated|markdown }}
{% set daysToFuture = diff_from_today_in_days(meetup.startDateTime) %}

{{ post|link }}

Documentation

Thanks to @crazko you can enjoy neat documentation and see projects that use Statie at statie.org., (*20)

Contributing

Open an issue or send a pull-request to main repository., (*21)

The Versions