Skip to content
[DEPRECATED] [READ-ONLY] Use Symfony plugin instead →
PHP HTML Other
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
bin README: add sonar badge Jan 25, 2020
config README: add sonar badge Jan 25, 2020
docs README: add sonar badge Jan 25, 2020
packages apply constant variable/property rule from Rector Feb 19, 2020
src apply constant variable/property rule from Rector Feb 19, 2020
templates README: add sonar badge Jan 25, 2020
tests apply constant variable/property rule from Rector Feb 19, 2020
.gitattributes README: add sonar badge Jan 25, 2020
.gitignore
LICENSE README: add sonar badge Jan 25, 2020
README.md deprecated + suggest replacement Mar 12, 2020
composer.json
phpunit.xml README: add sonar badge Jan 25, 2020

README.md

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

Use Symfony Static Dumper instead

Downloads

Statie takes HTML, Markdown and Twig files and generates static HTML page.

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.

Last step is install node dependencies:

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:

# 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:

{# source/_layouts/default.twig #}

<p>Welcome to: {{ site_url }}</p>

<p>Checkout my FB page: {{ socials.facebook }}</p>

Do You Write Posts?

Create a new empty .md file with date, webalized title and ID:

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

Statie privides default template:

id: __ID__
title: "__TITLE__"
---

Do you want your own template? Configure path to it:

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

That's it!

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?

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

This will generate 2 pages:

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

With parameters as JSON, that anyone can use now.

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:

parameters:
    joind_in_talks:
        # ...

Then you can use them like any other parameter in your Statie templates:

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

Useful Twig Filters

All from this basic set and more:

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

<!-- picks all posts defined in "related_items: [1]" in post -->
{% 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.

Contributing

Open an issue or send a pull-request to main repository.

You can’t perform that action at this time.