drdplusinfo / statie
Static Site Generator
Requires
- php: ^7.1|^8.0
- ext-dom: *
- erusev/parsedown: ^1.7
- erusev/parsedown-extra: ^0.8.1
- granam/assets-version: ^2.0
- granam/string: ^4.0
- guzzlehttp/guzzle: ^6.3
- j7mbo/twitter-api-php: ^1.0
- latte/latte: ^2.5
- nette/finder: ^2.4
- nette/utils: ^2.5|^3.0
- phpgt/dom: ^2.1
- symfony/config: ^3.4|^4.1
- symfony/console: ^3.4|^4.1
- symfony/dependency-injection: ^3.4|^4.1
- symfony/dotenv: ^4.2
- symfony/event-dispatcher: ^3.4|^4.1
- symfony/expression-language: ^5.1
- symfony/finder: ^3.4|^4.1
- symfony/http-kernel: ^3.4|^4.1
- symfony/yaml: ^3.4|^4.1
- symplify/package-builder: ^5.4
- tracy/tracy: ^2.5
- twig/twig: ^2.5
Requires (Dev)
- phpunit/phpunit: ^7.5|^8.0
- dev-master
- v6.0.x-dev
- v6.0.10
- v6.0.9
- v6.0.8
- v6.0.7
- v6.0.6
- v6.0.5
- v6.0.4
- 6.0.3
- 6.0.2
- 6.0.1
- v6.0.0
- v5.6.x-dev
- v5.6.6
- v5.6.5
- v5.6.4
- v5.6.3
- v5.6.2
- v5.6.1
- v5.6.0
- v5.5.x-dev
- v5.5.28
- v5.5.27
- v5.5.26
- v5.5.25
- v5.5.24
- v5.5.23
- v5.5.22
- v5.5.21
- v5.5.20
- v5.5.19
- v5.5.18
- v5.5.17
- v5.5.16
- v5.5.15
- v5.5.14
- v5.5.13
- v5.5.12
- v5.5.11
- v5.5.10
- v5.5.9
- v5.5.8
- v5.5.7
- v5.5.6
- v5.5.5
- v5.5.4
- v5.5.3
- v5.5.2
- v5.5.1
- v5.5.0
- v5.4.16
- v5.4.15
- v5.4.14
- v5.4.13
- v5.4.12
- v5.4.11
- v5.4.10
- v5.4.9
- v5.4.8
- v5.4.7
- v5.4.6
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- v5.3.12
- v5.3.11
- v5.3.10
- v5.3.9
- v5.3.8
- v5.3.7
- v5.3.6
- v5.3.5
- v5.3.4
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.22
- v5.2.20
- v5.2.19
- v5.2.18
- v5.2.17
- v5.2.16
- v5.2.15
- v5.2.14
- v5.2.13
- v5.2.12
- v5.2.11
- v5.2.10
- v5.2.9
- v5.2.8
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- v5.0.2
- v5.0.1
- v5.0.0
- v4.8.0
- v4.7.0
- v4.6.1
- v4.6.0
- v4.5.1
- v4.5.0
- v4.4.2
- v4.4.1
- v4.4.0
- v4.3.0
- v4.2.3
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v4.0.0beta1
- v4.0.0alpha6
- v4.0.0alpha5
- v4.0.0alpha4
- v4.0.0alpha3
- v4.0.0alpha2
- v4.0.0alpha1
- v3.2.30
- v3.2.29
- v3.2.28
- v3.2.27
- v3.2.26
- v3.2.25
- v3.2.24
- v3.2.23
- v3.2.22
- v3.2.21
- v3.2.20
- v3.2.18
- v3.2.17
- v3.2.15
- v3.2.14
- v3.2.13
- v3.2.12
- v3.2.11
- v3.2.10
- v3.2.9
- v3.2.7
- v3.2.6
- v3.2.5
- v3.2.4
- v3.2.3
- v3.2.2
- v3.2.1
- v3.2.0
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v3.0.0-RC5
- v3.0.0-RC4
- v3.0.0-RC3
- v3.0.0-RC2
- v3.0.0-RC1
- v2.5.12
- v2.5.10
- v2.5.9
- v2.5.8
- v2.5.7
- v2.5.6
- v2.5.5
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- v2.3.4
- v2.3.3
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.15
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v2.0.0-RC3
- v2.0.0-RC2
- v2.0.0-RC1
- v1.4.10
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.21
- v1.2.20
- v1.2.19
- v1.2.18
- v1.2.17
- v1.2.16
- v1.2.15
- v1.2.14
- v1.2.13
- v1.2.12
- v1.2.11
- v1.2.10
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
This package is auto-updated.
Last update: 2024-11-28 17:08:56 UTC
README
Statie - Modern and Simple Static Site Generator in PHP
Statie takes HTML, Markdown and Twig or Latte files and generates static HTML page.
Install
composer require symplify/statie
How to Generate and See the Website?
- Prepare content for Statie
vendor/bin/statie init
Do you prefer Latte?
vendor/bin/statie init --templating latte
This will generate config, templates, layouts and gulp code, so you can enjoy live preview.
Last step is install node dependencies:
npm install
- Generate static site from
/source
(argument) to/output
(default value) in HTML:
vendor/bin/statie generate source
- Run website locally
gulp
- And see web in browser localhost:8000.
Do you use Jekyll or Sculpin?
We'll help you migrate:
vendor/bin/statie migrate-jekyll vendor/bin/statie migrate-sculpin
They will do 95 % of migration for you. If you still struggle with migration, look at:
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 and Latte Filters
All from Latte basic set and more:
Twig
{% 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 }}
Latte
{var $users = ($users|sort_by_field:'name')} {var $users = ($users|sort_by_field:'name', 'desc')} <!-- picks all posts defined in "related_items: [1]" in post --> {var $relatedPosts = (post|related_items)} {$content|reading_time} mins {$post->getRawContent()|reading_time} mins {$perexDeprecated|markdown} {var $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.