From e505161caa95172c80ec1ea1a833a4a823ea540d Mon Sep 17 00:00:00 2001 From: Maya McDougall <12779160+mayamcdougall@users.noreply.github.com> Date: Fri, 25 Feb 2022 13:57:59 -0500 Subject: [PATCH] Pico 3.0 Compatibility and Improvements - Added compatibility for the upcoming Pico 3.0, as well as various other improvements. - "Single" template is no longer required. Layout switches automatically when not on the `index` page. - This will unfortunately mean existing users will need to remove the `Template:` property from their metadata, but it simplifies the user experience going forward. - Reflowed file indentation and did a general clean up of code. - New `pico-theme.yml` for Pico 2.0+, defines metadata properties and prevents Pico from relying on PicoDeprecated when using theme. - Page images only displayed if they are defined. (Prevents broken image on non-modal 404 page). - Refined modal 404 page to match regular pages better. - Removed HTML from sample `intro.md`. - Probably other changes and refinements I've forgotten to list. --- content-sample/index.md | 10 +- content-sample/intro.md | 7 +- dimension/index.twig | 254 +++++++++++++++++++++++---------------- dimension/pico-theme.yml | 14 +++ dimension/single.twig | 36 ------ 5 files changed, 171 insertions(+), 150 deletions(-) create mode 100644 dimension/pico-theme.yml delete mode 100644 dimension/single.twig diff --git a/content-sample/index.md b/content-sample/index.md index 1798d25..fe5a770 100644 --- a/content-sample/index.md +++ b/content-sample/index.md @@ -4,8 +4,8 @@ Tagline: Best Flat File CMS Description: We're expert to create beautiful design & smart technology Form: https://api.formbucket.com/f/buk_JUzic5YM0OlLvGRe1viZoE5O Social: - linkedin : https://tn.linkedin.com/in/MohamedSafouanBesrour - bitcoin : https://tipybit.com/besrour - github : https://github.com/BesrourMS - instagram: https://www.instagram.com/besrourms ---- \ No newline at end of file + linkedin: https://tn.linkedin.com/in/MohamedSafouanBesrour + bitcoin: https://tipybit.com/besrour + github: https://github.com/BesrourMS + instagram: https://www.instagram.com/besrourms +--- diff --git a/content-sample/intro.md b/content-sample/intro.md index 1ac3429..08e475a 100644 --- a/content-sample/intro.md +++ b/content-sample/intro.md @@ -1,8 +1,9 @@ --- Title: Intro Image: https://source.unsplash.com/random/960x320 -Template: single Nav: 1 --- -

Aenean ornare velit lacus, ac varius enim ullamcorper eu. Proin aliquam facilisis ante interdum congue. Integer mollis, nisl amet convallis, porttitor magna ullamcorper, amet egestas mauris. Ut magna finibus nisi nec lacinia. Nam maximus erat id euismod egestas. By the way, check out my awesome work.

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dapibus rutrum facilisis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam tristique libero eu nibh porttitor fermentum. Nullam venenatis erat id vehicula viverra. Nunc ultrices eros ut ultricies condimentum. Mauris risus lacus, blandit sit amet venenatis non, bibendum vitae dolor. Nunc lorem mauris, fringilla in aliquam at, euismod in lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In non lorem sit amet elit placerat maximus. Pellentesque aliquam maximus risus, vel sed vehicula.

\ No newline at end of file + +Aenean ornare velit lacus, ac varius enim ullamcorper eu. Proin aliquam facilisis ante interdum congue. Integer mollis, nisl amet convallis, porttitor magna ullamcorper, amet egestas mauris. Ut magna finibus nisi nec lacinia. Nam maximus erat id euismod egestas. By the way, check out my [awesome work](#work). + +Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis dapibus rutrum facilisis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam tristique libero eu nibh porttitor fermentum. Nullam venenatis erat id vehicula viverra. Nunc ultrices eros ut ultricies condimentum. Mauris risus lacus, blandit sit amet venenatis non, bibendum vitae dolor. Nunc lorem mauris, fringilla in aliquam at, euismod in lectus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In non lorem sit amet elit placerat maximus. Pellentesque aliquam maximus risus, vel sed vehicula. diff --git a/dimension/index.twig b/dimension/index.twig index 98b4499..817f2f1 100644 --- a/dimension/index.twig +++ b/dimension/index.twig @@ -1,106 +1,148 @@ - - - - - - {{ site_title }}{% if meta.tagline %} - {{ meta.tagline|striptags }}{% endif %} -{% if meta.description %} - -{% endif %} -{% if current_page %} - -{% endif %} - - - - - - - - - - - - -
- - - -
-{% for page in pages|sort_by([ 'meta', 'nav' ]) if page.meta.template == "single" and not page.hidden %} -
-

{{ page.title }}

- {{ page.title }} -

{{ page.id|content }}

-
-{% endfor %} - -
-

Contact

-
-
- - -
-
- - -
-
- - -
-
    -
  • -
  • -
-
-
    -{% for icon, link in meta.social %} -
  • {{ icon }}
  • -{% endfor %} -
-
-
-

Sorry page not found

-
-
- - -
- -
- - - - - - - \ No newline at end of file + + + {% if current_page.id == "index" %} + {% set is_front_page = true %} + {% endif %} + + + + + {% if is_front_page %} + {{ site_title }}{% if meta.tagline %} - {{ meta.tagline|striptags }}{% endif %} + {% else %} + {{ meta.title }} | {{ site_title }} + {% endif %} + + {% if meta.description %} + + {% endif %} + {% if current_page %} + + {% endif %} + + + + + + + + + + + + + +
+ {% if is_front_page %} + + + + +
+ {% for page in pages()|sort_by([ 'meta', 'nav' ]) %} + {% if not page.hidden %} +
+

{{ page.title }}

+ {% if page.meta.image %} + + {{ page.title }} + + {% endif %} + {{ page.id|content }} +
+ {% endif %} + {% endfor %} + + +
+

Contact

+
+
+ + +
+
+ + +
+
+ + +
+
    +
  • +
  • +
+
+
    + {% for icon, link in meta.social %} +
  • {{ icon }}
  • + {% endfor %} +
+
+ +
+

Error 404

+

Sorry, that page wasn't found.

+
+
+ {% else %} + +
+

{{ meta.title }}

+ {% if meta.image %} + + {{ meta.title }} + + {% endif %} + {{ content }} +
+ {% endif %} + + + + +
+ + +
+ + + + + + {% if is_front_page %} + + {% endif %} + + + diff --git a/dimension/pico-theme.yml b/dimension/pico-theme.yml new file mode 100644 index 0000000..e4819f3 --- /dev/null +++ b/dimension/pico-theme.yml @@ -0,0 +1,14 @@ +api_version: 3 # Use Pico's latest API version for themes + +meta: # Register meta headers used by this theme + Icon: icon + Tagline: tagline + Image: image + Social: social + Nav: nav + Form: form + +twig_config: # Twig template engine config + autoescape: html # Let Twig escape variables by default + strict_variables: false # If set to true, Twig will bail out when unset variables are being used + charset: utf-8 # The charset used by Twig templates diff --git a/dimension/single.twig b/dimension/single.twig deleted file mode 100644 index 4bec0aa..0000000 --- a/dimension/single.twig +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - {{ meta.title }} | {{ site_title }} - - - - - - - -
-
-

{{ meta.title }}

- {{ meta.title }} -

{{ content }}

-
- - - -
- -
- - - - - - - - -