diff --git a/building-static-websites-sculpin/code/configuration.txt b/building-static-websites-sculpin/code/configuration.txt index 9800895..3d4d197 100644 --- a/building-static-websites-sculpin/code/configuration.txt +++ b/building-static-websites-sculpin/code/configuration.txt @@ -1,6 +1,5 @@ --- -title: My talk -foo: bar +name: My talk menu_links: - - { title: About, href: / } - - { title: Talks, href: /talks/ } + - { title: Home, href: / } + - { title: About, href: /about } diff --git a/building-static-websites-sculpin/images/packagist.png b/building-static-websites-sculpin/images/packagist.png new file mode 100644 index 0000000..b127907 Binary files /dev/null and b/building-static-websites-sculpin/images/packagist.png differ diff --git a/building-static-websites-sculpin/slides.rst b/building-static-websites-sculpin/slides.rst index d84a3b0..8a8f2df 100644 --- a/building-static-websites-sculpin/slides.rst +++ b/building-static-websites-sculpin/slides.rst @@ -35,23 +35,31 @@ What do I use it for? * My personal website * Some client websites * HTML prototypes and testing -* Learning YAML and Twig (and maybe some Symfony) +* Learning YAML and Twig (and some Symfony) Installation ============ ``composer require sculpin/sculpin`` +| + +``composer create-project sculpin/blog-skeleton my-blog`` + +| + +``composer create-project opdavies/sculpin-skeleton my-site`` + Using Sculpin ============= * Configuration lives in ``app/config`` -* Source code lives in ``source``. +* Source files live in ``source``. Generate a site =============== -* ``sculpin generate`` +* ``vendor/bin/sculpin generate`` * ``--server`` * ``--watch`` * ``--env`` @@ -62,6 +70,18 @@ source/index.md .. code-block:: markdown :include: code/index.md.txt +output_dev/index.html +===================== + +.. code-block:: html + + + + + +

Hello, World!

+ + Configuration ============= @@ -70,9 +90,19 @@ Configuration - ``sculpin_site_{env}.yml`` - Key-value pairs -.. code-block:: markdown +.. code-block:: yaml :include: code/configuration.txt +Using on pages +============== + +.. code-block:: html + + + + {{ site.name }} + + YAML front matter ================= @@ -142,6 +172,50 @@ Using on pages

{{ testimonial.text }}

{% endfor %} +Layouts +======= + +.. code-block:: twig + + {# source/_layouts/app.html.twig #} + + + + + {{ site.name|default('Sculpin Skeleton') }} + + + {% block body %}{% endblock %} + + + +Layouts +======= + +.. code-block:: twig + + {# source/_layouts/default.html.twig #} + + {% extends 'app' %} + + {% block body %} + {% block content %}{% endblock %} + {% endblock %} + +Includes +======== + +.. code-block:: twig + + {% include 'about-author' with { + avatar: site.avatar, + work: site.work, + } only %} + + {% for link in links %} + {% include 'menu-link' with { link } only %} + {% endfor %} + Content types ============= @@ -164,16 +238,58 @@ Accessing custom content types use: - projects --- + {% for project in data.projects %}

{{ project.title }}

{% endfor %} +.. page:: titlePage + +.. class:: centredtitle + +Demo + +.. page:: standardPage + Extending Sculpin ================= -* Custom (Symfony) bundles -* Twig extensions -* Other Symfony components or PHP libraries +.. code-block:: yaml + + # app/config/sculpin_kernel.yml + + ... + + services: + App\TwigExtension\TalkExtension: + tags: + - { name: twig.extension } + +.. page:: imagePage + +.. image:: images/packagist.png + :width: 22cm + +.. page:: standardPage + + +.. code-block:: php + :startinline: true + + // app/SculpinKernel.php + + use Opdavies\Sculpin\Bundle\TwigMarkdownBundle\SculpinTwigMarkdownBundle; + use Sculpin\Bundle\SculpinBundle\HttpKernel\AbstractKernel; + + final class SculpinKernel extends AbstractKernel + { + protected function getAdditionalSculpinBundles(): array + { + return [ + SculpinTwigMarkdownBundle::class, + ]; + } + } Thanks! ======= @@ -181,8 +297,8 @@ Thanks! References: * https://sculpin.io -* https://github.com/sculpin/sculpin -* https://github.com/opdavies/sculpin-skeleton +* https://github.com/opdavies/sculpin-talk-demo +* https://github.com/opdavies/oliverdavies.uk * https://github.com/opdavies/docker-image-sculpin-serve |