Giter Club home page Giter Club logo

statie's Introduction

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

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.

statie's People

Contributors

tomasvotruba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.