Updates for PHP Berkshire

This commit is contained in:
Oliver Davies 2024-08-28 13:00:00 +01:00
parent d2530a138a
commit 43b8fdfd9c
10 changed files with 140 additions and 91 deletions

View file

@ -1,5 +1,5 @@
--- ---
name: oliverdavies.uk name: oliverdavies.uk
menu_links: menu_links:
- { title: Home, href: / } - { title: Home, href: / }
- { title: About, href: /about } - { title: About, href: /about }

View file

@ -2,10 +2,9 @@
title: My Daily Email Archive title: My Daily Email Archive
layout: default layout: default
use: use:
- daily_email - daily_email
--- ---
{% for email in data.daily_emails %} {% for email in data.daily_emails %}
<p>{{ email.title }}</p> <p>{{ email.title }}</p>
{% endfor %} {% endfor %}

View file

@ -1,12 +1,12 @@
--- ---
... ...
testimonials: testimonials:
- { name: ..., role: ..., text: ..., url: ... } - { name: ..., role: ..., text: ..., url: ... }
- { name: ..., role: ..., text: ..., url: ... } - { name: ..., role: ..., text: ..., url: ... }
- { name: ..., role: ..., text: ..., url: ... } - { name: ..., role: ..., text: ..., url: ... }
--- ---
{% for testimonial in page.testimonials %} {% for testimonial in page.testimonials %}
<h2>{{ testimonial.name }} - {{ testimonial.role }}</h2> <h2>{{ testimonial.name }} - {{ testimonial.role }}</h2>
<p>{{ testimonial.text }}</p> <p>{{ testimonial.text }}</p>
{% endfor %} {% endfor %}

View file

@ -3,5 +3,3 @@ layout: post
title: New blog post title: New blog post
draft: yes draft: yes
--- ---
# My new blog post

View file

@ -2,10 +2,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="{{ site.locale|default('en') }}"> <html lang="{{ site.locale|default('en') }}">
<head> <head>
<title>{{ site.name|default('Sculpin Skeleton') }}</title> <title>{{ site.name|default('Sculpin Skeleton') }}</title>
</head> </head>
<body> <body>
{% block body %}{% endblock %} {% block body %}{% endblock %}
</body> </body>
</html> </html>

View file

@ -1,14 +1,13 @@
. app/
├── app config/
│   ├── config sculpin_kernel.yml
│   │   ├── sculpin_kernel.yml sculpin_site.yml
│   │   └── sculpin_site.yml composer.json
├── composer.json composer.lock
├── composer.lock output_dev/
├── output_dev output_prod/
├── output_prod source/
├── source _includes/
│   ├── _includes _templates/
│   ├── _templates index.md
│   └── index.md vendor/
└── vendor

View file

@ -4,4 +4,4 @@
{{ 'today'|date('Y') }} {{ 'today'|date('Y') }}
{{ 'today'|date('Y') - 2007 }} # 17 {{ 'today'|date('Y') - 2007 }} # 17 (years of experience)

View file

@ -1,16 +1,14 @@
--- ---
title: Building Static Websites with Sculpin title: Building Static Websites with Sculpin
events: events:
- - name: PHP Berkshire
name: BrumPHP date: 2024-08-28
date: 2024-05-23 location: Reading, UK
location: Birmingham, UK url: https://www.meetup.com/php-berkshire/events/301850284
url: https://www.eventbrite.com/e/brumphp-23rd-may-2024-tickets-803037766577 - name: BrumPHP
- date: 2024-05-23
name: PHP South West location: Birmingham, UK
date: 2024-02-14 url: https://www.eventbrite.com/e/brumphp-23rd-may-2024-tickets-803037766577
location: Bristol, UK
url: https://www.meetup.com/php-sw/events/298880313
--- ---
// end yaml // end yaml

View file

@ -1,18 +1,15 @@
{% set talks = site.talks|filter(talk => talk.speaker == page.name) %} {% set talks = site.talks|filter(talk => talk.speaker == page.name) %}
{% if talks is not empty %} {% if talks is not empty %}
<section class="mt-10"> <section>
<h2 class="text-2xl font-bold">Talks <h2>Talks by {{ page.name }}</h2>
<span class="sr-only"> by {{ page.name }}</span></h2>
<div class="mt-6"> <div>
<ul class="pl-4 list-disc"> <ul>
{% for talk in talks %} {% for talk in talks %}
<li> <li><a href="#0">{{ talk.title }}</a></li>
<a class="hover:underline" href="#0">{{ talk.title }}</a> {% endfor %}
</li> </ul>
{% endfor %} </div>
</ul> </section>
</div>
</section>
{% endif %} {% endif %}

View file

@ -9,6 +9,12 @@ Building static websites with Sculpin
Oliver Davies (@opdavies) Oliver Davies (@opdavies)
|
.. class:: centred
https://opdavi.es/phpberks
.. page:: imagePage .. page:: imagePage
.. image:: images/druplicon.png .. image:: images/druplicon.png
@ -23,6 +29,31 @@ Oliver Davies (@opdavies)
.. page:: standardPage .. page:: standardPage
What is a static website?
=========================
.. code::
.htaccess
assets/images/od-logo.jpg
build/tailwind.css
call/index.html
daily/2024/03/18/automated-drupal-11-compatibility-fixes/index.html
drupal-upgrade/index.html
favicon.ico
index.html
phpberks/index.html
podcast/19-sam-mortenson/index.html
pricing/index.html
talks/taking-flight-with-tailwind-css/index.html
talks/tdd-test-driven-drupal/index.html
.. raw:: pdf
TextAnnotation "HTML, CSS, JS. No PHP or server-side code."
TextAnnotation "How I started building websites."
TextAnnotation "The things you usually have a CMS or framework generate."
What is Sculpin? What is Sculpin?
================ ================
@ -42,18 +73,21 @@ Why use a static site generator?
================================ ================================
- Rapid development. - Rapid development.
- Templating.
- Security. - Security.
- Performance. - Performance.
- Easy and cheap to host. - Easy and cheap to host.
.. raw:: pdf .. raw:: pdf
TextAnnotation "Leveraging templating features, such as conditionals, loops, partials and includes, template inheritance."
TextAnnotation "Static websites are fast and secure as they don't have a database and only need a simple hosting environment with a basic web server." TextAnnotation "Static websites are fast and secure as they don't have a database and only need a simple hosting environment with a basic web server."
TextAnnotation "Works with a simple Apache, Nginx or Caddy server, or with services like Vercel and Netlify."
What do I use it for? What do I use it for?
===================== =====================
* My personal website. * My personal website and Zettelkasten.
* Some client websites. * Some client websites.
* HTML prototypes and testing. * HTML prototypes and testing.
* Learning YAML and Twig (and some Symfony). * Learning YAML and Twig (and some Symfony).
@ -92,18 +126,18 @@ Using Sculpin
TextAnnotation "The file structure of a Sculpin project." TextAnnotation "The file structure of a Sculpin project."
PageBreak PageBreak
.. code-block:: shell .. code-block:: bash
:include: ./code/project-structure.txt :include: ./code/project-structure.txt
:hl_lines: 6,7,14 :hl_lines: 5,6,13
.. raw:: pdf .. raw:: pdf
TextAnnotation "PHP-based project." TextAnnotation "PHP-based project."
PageBreak PageBreak
.. code-block:: shell .. code-block:: bash
:include: ./code/project-structure.txt :include: ./code/project-structure.txt
:hl_lines: 2,3,4,5 :hl_lines: 1,2,3,4
.. raw:: pdf .. raw:: pdf
@ -112,16 +146,16 @@ Using Sculpin
.. code-block:: shell .. code-block:: shell
:include: ./code/project-structure.txt :include: ./code/project-structure.txt
:hl_lines: 10,11,12,13 :hl_lines: 9,10,11,12
.. raw:: pdf .. raw:: pdf
TextAnnotation "Source files." TextAnnotation "Source files."
PageBreak PageBreak
.. code-block:: shell .. code-block:: bash
:include: ./code/project-structure.txt :include: ./code/project-structure.txt
:hl_lines: 8,9 :hl_lines: 7,8
.. raw:: pdf .. raw:: pdf
@ -138,7 +172,7 @@ Generate a site
source/index.md source/index.md
=============== ===============
.. code-block:: markdown .. code-block::
:include: code/index.md.txt :include: code/index.md.txt
:linenos: :linenos:
@ -146,7 +180,7 @@ source/index.md
source/index.md source/index.md
=============== ===============
.. code-block:: markdown .. code-block:: bash
:include: code/index.md.txt :include: code/index.md.txt
:linenos: :linenos:
:hl_lines: 1,2,3,4 :hl_lines: 1,2,3,4
@ -154,7 +188,7 @@ source/index.md
source/index.md source/index.md
=============== ===============
.. code-block:: markdown .. code-block:: bash
:include: code/index.md.txt :include: code/index.md.txt
:linenos: :linenos:
:hl_lines: 2 :hl_lines: 2
@ -162,7 +196,7 @@ source/index.md
source/index.md source/index.md
=============== ===============
.. code-block:: markdown .. code-block:: bash
:include: code/index.md.txt :include: code/index.md.txt
:linenos: :linenos:
:hl_lines: 3 :hl_lines: 3
@ -170,7 +204,7 @@ source/index.md
source/index.md source/index.md
=============== ===============
.. code-block:: markdown .. code-block:: bash
:include: code/index.md.txt :include: code/index.md.txt
:linenos: :linenos:
:hl_lines: 6 :hl_lines: 6
@ -258,7 +292,7 @@ YAML front matter
.. raw:: pdf .. raw:: pdf
TextAnnotation "Draft pages aren't generated when ENV=prod". TextAnnotation "Draft pages aren't generated when env=prod".
More front matter More front matter
================= =================
@ -272,13 +306,11 @@ More front matter
title: New blog post title: New blog post
draft: yes draft: yes
tags: tags:
- drupal - drupal
- php - php
- sculpin - sculpin
--- ---
# My new blog post
Even more front matter Even more front matter
====================== ======================
@ -291,15 +323,13 @@ Even more front matter
title: New blog post title: New blog post
draft: yes draft: yes
tags: tags:
- drupal - drupal
- php - php
- sculpin - sculpin
tweets: yes tweets: yes
foo: bar foo: bar
--- ---
# My new blog post
Using on pages Using on pages
============== ==============
@ -443,8 +473,8 @@ Content types
# app/config/sculpin_kernel.yml # app/config/sculpin_kernel.yml
sculpin_content_types: sculpin_content_types:
daily_emails: daily_emails:
permalink: daily/:slug_title/ permalink: daily/:slug_title/
.. raw:: pdf .. raw:: pdf
@ -515,6 +545,7 @@ Making things more dynamic
.. code-block:: twig .. code-block:: twig
:include: ./code/twig-1.txt :include: ./code/twig-1.txt
:linenos:
:hl_lines: 7 :hl_lines: 7
.. raw:: pdf .. raw:: pdf
@ -524,6 +555,7 @@ Making things more dynamic
.. code-block:: php .. code-block:: php
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:end-before: // end yaml :end-before: // end yaml
:linenos:
.. raw:: pdf .. raw:: pdf
@ -531,6 +563,7 @@ Making things more dynamic
.. code-block:: twig .. code-block:: twig
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:linenos:
:start-after: // start twig :start-after: // start twig
.. raw:: pdf .. raw:: pdf
@ -540,6 +573,7 @@ Making things more dynamic
.. code-block:: twig .. code-block:: twig
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:start-after: // start twig :start-after: // start twig
:linenos:
:hl_lines: 1 :hl_lines: 1
.. raw:: pdf .. raw:: pdf
@ -549,6 +583,7 @@ Making things more dynamic
.. code-block:: javascript .. code-block:: javascript
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:hl_lines: 3,7 :hl_lines: 3,7
:linenos:
:start-after: // start twig :start-after: // start twig
.. raw:: pdf .. raw:: pdf
@ -559,6 +594,7 @@ Making things more dynamic
.. code-block:: twig .. code-block:: twig
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:start-after: // start twig :start-after: // start twig
:linenos:
:hl_lines: 4,6 :hl_lines: 4,6
.. raw:: pdf .. raw:: pdf
@ -568,6 +604,7 @@ Making things more dynamic
.. code-block:: twig .. code-block:: twig
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:start-after: // start twig :start-after: // start twig
:linenos:
:hl_lines: 5 :hl_lines: 5
.. raw:: pdf .. raw:: pdf
@ -577,6 +614,7 @@ Making things more dynamic
.. code-block:: javascript .. code-block:: javascript
:include: ./code/twig-2.txt :include: ./code/twig-2.txt
:start-after: // start twig :start-after: // start twig
:linenos:
:hl_lines: 9 :hl_lines: 9
.. raw:: pdf .. raw:: pdf
@ -585,6 +623,7 @@ Making things more dynamic
.. code-block:: javascript .. code-block:: javascript
:include: ./code/twig-3.txt :include: ./code/twig-3.txt
:linenos:
.. raw:: pdf .. raw:: pdf
@ -592,7 +631,8 @@ Making things more dynamic
.. code-block:: javascript .. code-block:: javascript
:include: ./code/twig-3.txt :include: ./code/twig-3.txt
:hl_lines: 1,3,18 :linenos:
:hl_lines: 1,3,15
.. raw:: pdf .. raw:: pdf
@ -600,7 +640,26 @@ Making things more dynamic
.. code-block:: javascript .. code-block:: javascript
:include: ./code/twig-3.txt :include: ./code/twig-3.txt
:hl_lines: 5,6,10,11,12,13,14 :linenos:
:hl_lines: 5
.. raw:: pdf
PageBreak
.. code-block:: javascript
:include: ./code/twig-3.txt
:linenos:
:hl_lines: 9,11
.. raw:: pdf
PageBreak
.. code-block:: javascript
:include: ./code/twig-3.txt
:linenos:
:hl_lines: 10
.. page:: titlePage .. page:: titlePage
@ -620,9 +679,9 @@ Extending Sculpin
... ...
services: services:
App\TwigExtension\TalkExtension: App\TwigExtension\TalkExtension:
tags: tags:
- { name: twig.extension } - { name: twig.extension }
.. page:: imagePage .. page:: imagePage
@ -655,10 +714,9 @@ Thanks!
References: References:
* https://www.oliverdavies.uk/brumphp |
* https://sculpin.io
* https://github.com/opdavies/phpsw-sculpin-demo https://www.oliverdavies.uk/phpberks
* https://github.com/opdavies/oliverdavies.uk
| |