Skip to content

Commit fdb4a2e

Browse files
authored
Merge pull request #2 from picocms/pico-2.1
Pico 2.1
2 parents b33fe25 + 53a90f7 commit fdb4a2e

File tree

10 files changed

+132
-48
lines changed

10 files changed

+132
-48
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,28 @@ Pico Default Theme Changelog
88
refer to both the UPGRADE and NEWS sections of the docs for more
99
details.
1010

11+
### Version 2.1.0
12+
Released: 2019-11-24
13+
14+
```
15+
* [New] Add Pico's official logo and tagline
16+
* [New] Add some utility classes for typography and images
17+
* [Changed] Improve documentation of `pico-theme.yml`
18+
* [Changed] Various small improvements
19+
```
20+
21+
### Version 2.1.0-beta.1
22+
Released: 2019-11-03
23+
24+
```
25+
* [Changed] Add basic `pico-theme.yml` to use API v3, enable Twig's autoescape
26+
feature (no changes necessary) and register `Social` meta header
27+
* [Changed] Use Pico's `pages` Twig function to create the main navigation
28+
* [Changed] Improve formatting of definition lists and inline code snippets
29+
* [Changed] Improve JSDoc class docs
30+
* [Changed] Various small improvements
31+
```
32+
1133
### Version 2.0.5-beta.1
1234
Released: 2019-01-03
1335

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Please refer to [`picocms/Pico`](https://github.com/picocms/Pico) to get info ab
1010
Screenshot
1111
----------
1212

13-
![Pico Screenshot](https://picocms.github.io/screenshots/pico-20.png)
13+
![Pico Screenshot](https://picocms.github.io/screenshots/pico-21.png)
1414

1515
Install
1616
-------
@@ -36,11 +36,13 @@ theme: my_theme
3636
3737
You can now edit the theme's stylesheets and JavaScript to fit your needs. If you rather want to use a third-party theme, simply add the theme's directory to your `themes/` directory (e.g. `themes/some_other_theme/`) and update your `config/config.yml` accordingly. Pico's default theme is now completely disabled and won't ever interfere with your custom theme or your website in general anymore. If you want to use Pico's default theme again, either remove the line or replace it by `theme: default`.
3838

39-
Anyway, since Pico's default theme is meant to be a starting point for your own theme, it demonstrates how themes can allow one to tweak a theme's behavior. For this reason it supports a "Widescreen" mode: By adding `theme_config.widescreen: true` to your `config/config.yml`, the theme's main container grows from 768px to 1152px breadth due to adding `class="widescreen"` to the website's `<body>` element. Pico's default theme furthermore supports adding social buttons to its footer. Rather than using Pico's config for this, it uses the YAML Frontmatter of the `content/_meta.md` Markdown file. Here's `content/_meta.md` from Pico's sample contents:
39+
Anyway, since Pico's default theme is meant to be a starting point for your own theme, it demonstrates how themes can allow one to tweak a theme's behavior. For this reason it supports a "Widescreen" mode: By adding `theme_config.widescreen: true` to your `config/config.yml`, the theme's main container grows from 768px to 1152px breadth due to adding `class="widescreen"` to the website's `<body>` element. Pico's default theme furthermore supports displaying both a logo and a tagline in its header, as well as adding social buttons to its footer. Rather than using Pico's config for this, it uses the YAML Frontmatter of the `content/_meta.md` Markdown file. Here's `content/_meta.md` from Pico's sample contents:
4040

4141
```yaml
4242
---
43-
social:
43+
Logo: %theme_url%/img/pico-white.svg
44+
Tagline: Making the web easy.
45+
Social:
4446
- title: Visit us on GitHub
4547
url: https://github.com/picocms/Pico
4648
icon: octocat
@@ -50,6 +52,8 @@ social:
5052
---
5153
```
5254

55+
You should also check out the theme's `pico-theme.yml`: First of all it tells Pico to use the latest API version for themes and adjusts Pico's default Twig config. But more importantly it also registers the mentioned `widescreen` theme config as well as the meta headers `Logo`, `Tagline` and `Social`.
56+
5357
Getting Help
5458
------------
5559

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
"homepage": "http://picocms.org/",
77
"license": "MIT",
88
"authors": [
9+
{
10+
"name": "Daniel Rudolf",
11+
"email": "picocms.org@daniel-rudolf.de",
12+
"role": "Lead Developer"
13+
},
914
{
1015
"name": "The Pico Community",
1116
"homepage": "http://picocms.org/"
@@ -26,7 +31,8 @@
2631
"extra": {
2732
"installer-name": "default",
2833
"branch-alias": {
29-
"dev-master": "2.0.x-dev"
34+
"dev-master": "2.0.x-dev",
35+
"dev-pico-2.1": "2.1.x-dev"
3036
}
3137
}
3238
}

css/style.css

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @author Daniel Rudolf
1212
* @link http://picocms.org
1313
* @license http://opensource.org/licenses/MIT The MIT License
14-
* @version 2.0
14+
* @version 2.1
1515
*/
1616

1717
* {
@@ -65,17 +65,24 @@ body { display: flex; flex-direction: column; }
6565

6666
#header { background: #2EAE9B; }
6767

68-
#header h1 {
68+
#title, #logo {
6969
float: left;
70-
font-size: 2rem;
71-
margin: 0;
72-
padding: 1.5em 1em 1.5em 0;
70+
padding: 3em 3em 3em 0;
7371
}
74-
#header h1 a, #header h1 a:hover { color: #fff; }
72+
73+
#title * { margin: 0; color: #fff; }
74+
#title p { font-style: italic; }
75+
76+
#logo { height: 10.8em; }
77+
#logo * { display: block; height: 100%; }
78+
#logo img { min-width: 4.8em; }
79+
80+
#logo + #title h1 { margin: 0.8rem 0; }
81+
#logo + #title.tagline h1 { margin: 0; }
7582

7683
#nav {
77-
text-align: right;
7884
padding: 3em 0;
85+
text-align: right;
7986
}
8087
#nav ul {
8188
list-style: none;
@@ -127,13 +134,11 @@ body { display: flex; flex-direction: column; }
127134
@media (max-width: 767px) {
128135
#main { padding: 2em 0 1em; }
129136

130-
#header h1 {
131-
float: none;
132-
padding: 0.5em 0;
133-
}
137+
#title, #logo { padding: 2em 1.5em 2em 0; }
138+
#logo { height: 8.8em; }
134139

135140
#nav {
136-
clear: right;
141+
clear: both;
137142
padding: 0;
138143
}
139144
#nav ul {
@@ -153,7 +158,7 @@ body { display: flex; flex-direction: column; }
153158
display: block;
154159
float: right;
155160
width: 2em;
156-
margin: 0.6667em 0 0.6667em 1.3333em;
161+
margin: 0.6667em 0;
157162
font-size: 1.5rem;
158163
line-height: 2em;
159164
text-align: center;
@@ -185,7 +190,7 @@ p, td, th, li, dd {
185190
word-wrap: break-word;
186191
}
187192

188-
p, hr, table, .table-responsive, ol, ul, dl, pre, blockquote, fieldset {
193+
p, hr, table, .table-responsive, ol, ul, dl, dd, pre, blockquote, fieldset {
189194
margin-bottom: 1em;
190195
}
191196

@@ -219,6 +224,29 @@ hr {
219224

220225
abbr { text-decoration: underline dotted; }
221226

227+
/*** UTILITIES ***/
228+
229+
.align-left { text-align: left; }
230+
.align-center { text-align: center; }
231+
.align-right { text-align: right; }
232+
.align-justify { text-align: justify; }
233+
234+
.image { display: block; margin: 0 auto; }
235+
.image.xsmall { width: 20%; }
236+
.image.small { width: 40%; }
237+
.image.large { width: 60%; }
238+
.image.xlarge { width: 80%; }
239+
.image.float-left { float: left; margin: 1em 2em 1em 0; }
240+
.image.float-right { float: right; margin: 1em 0 1em 2em; }
241+
.image img { display: block; width: 100%; }
242+
243+
@media (max-width: 767px) {
244+
.image.xsmall { width: 60%; }
245+
.image.small { width: 80%; }
246+
.image.large, .image.xlarge { width: 100%; }
247+
.image.float-left, .image.float-right { float: none; margin: 0 auto; }
248+
}
249+
222250
/*** TABLES ***/
223251

224252
table { border-spacing: 0; }
@@ -269,15 +297,15 @@ code {
269297
border-radius: 0.3em;
270298
background: #f5f5f5;
271299
font-family: 'Droid Sans Mono', 'Courier New', 'Courier', monospace;
272-
font-size: 0.9rem;
300+
font-size: 0.85rem;
301+
line-height: 1.9824;
273302
}
274303

275304
pre {
276305
padding: 0 1em;
277306
border: 1px solid #ccc;
278307
border-radius: 0.3em;
279308
background: #f5f5f5;
280-
line-height: 1.4;
281309
}
282310
pre code {
283311
display: block;
@@ -286,6 +314,7 @@ pre code {
286314
border: 0 none;
287315
background: transparent;
288316
overflow-x: auto;
317+
line-height: 1.4;
289318
}
290319

291320
/*** BLOCKQUOTE ***/

img/pico-white.svg

Lines changed: 1 addition & 0 deletions
Loading

img/pico.svg

Lines changed: 1 addition & 0 deletions
Loading

index.twig

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title>
88
{% if meta.description %}
99
<meta name="description" content="{{ meta.description|striptags }}" />
10-
{% endif %}{% if meta.robots %}
10+
{% endif %}
11+
{% if meta.robots %}
1112
<meta name="robots" content="{{ meta.robots }}" />
1213
{% endif %}
1314

@@ -21,31 +22,38 @@
2122
</head>
2223
<body{% if config.theme_config.widescreen %} class="widescreen"{% endif %}>
2324

24-
<div id="header">
25+
<div id="header" role="banner">
2526
<div class="container">
2627
<a id="nav-toggle" title="Toggle Menu" role="button" aria-controls="nav" aria-expanded="false" tabindex="1">
2728
<span class="icon-menu" aria-hidden="true"></span>
2829
<span class="sr-only">Toggle Menu</span>
2930
</a>
30-
<h1>
31-
<a href="{{ "index"|link }}">{{ site_title }}</a>
32-
</h1>
33-
<div id="nav" role="region" tabindex="-1">
31+
{% if pages["_meta"].meta.logo %}
32+
<div id="logo" aria-hidden="true">
33+
<a href="{{ "index"|link }}">
34+
<img src="{{ pages["_meta"].meta.logo|url }}" alt="" />
35+
</a>
36+
</div>
37+
{% endif %}
38+
<div id="title"{{ pages["_meta"].meta.tagline ? ' class="tagline"' }}>
39+
<a href="{{ "index"|link }}">
40+
<h1>{{ site_title }}</h1>
41+
{{ pages["_meta"].meta.tagline|markdown }}
42+
</a>
43+
</div>
44+
<div id="nav" role="navigation" tabindex="-1">
3445
<ul>
35-
{% for page in pages if page.title and not page.hidden %}
36-
{% set pageDepth = page.id|split('/')|length %}
37-
{% if (pageDepth == 2) and (page.id ends with "/index") or (pageDepth == 1) %}
38-
<li{% if page.id == current_page.id %} class="active"{% endif %}>
39-
<a href="{{ page.url }}">{{ page.title }}</a>
40-
</li>
41-
{% endif %}
46+
{% for page in pages(depthOffset=-1) if page.title and not page.hidden %}
47+
<li{% if page.id == current_page.id %} class="active"{% endif %}>
48+
<a href="{{ page.url }}">{{ page.title }}</a>
49+
</li>
4250
{% endfor %}
4351
</ul>
4452
</div>
4553
</div>
4654
</div>
4755

48-
<div id="main">
56+
<div id="main" role="main">
4957
<div class="container">
5058
{{ content }}
5159
</div>
@@ -54,7 +62,7 @@
5462
<div id="footer">
5563
<div class="container">
5664
<div class="social">
57-
{% for social in pages._meta.meta.social %}
65+
{% for social in pages["_meta"].meta.social %}
5866
<a href="{{ social.url }}" title="{{ social.title }}" role="button">
5967
<span class="icon-{{ social.icon }}" aria-hidden="true"></span>
6068
<span class="sr-only">{{ social.title }}</span>

js/pico.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @author Daniel Rudolf
77
* @link http://picocms.org
88
* @license http://opensource.org/licenses/MIT The MIT License
9-
* @version 2.0
9+
* @version 2.1
1010
*/
1111

1212
function main()

js/utils.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
* @author Daniel Rudolf
77
* @link http://picocms.org
88
* @license http://opensource.org/licenses/MIT The MIT License
9-
* @version 2.0
9+
* @version 2.1
1010
*/
1111

1212
utils = {};
1313

1414
/**
1515
* Checks whether the client's browser is able to slide elements or not
1616
*
17-
* @return boolean TRUE when the browser supports sliding, FALSE otherwise
17+
* @return {bool} TRUE when the browser supports sliding, FALSE otherwise
1818
*/
1919
utils.canSlide = function ()
2020
{
@@ -24,11 +24,10 @@ utils.canSlide = function ()
2424
/**
2525
* Slides a element up (i.e. hide a element by changing its height to 0px)
2626
*
27-
* @param HTMLElement element the element to slide up
28-
* @param function finishCallback function to call when the animation has
27+
* @param {HTMLElement} element the element to slide up
28+
* @param {function} finishCallback function to call when the animation has
2929
* been finished (i.e. the element is hidden)
30-
* @param function startCallback function to call when the animation starts
31-
* @return void
30+
* @param {function} startCallback function to call when the animation starts
3231
*/
3332
utils.slideUp = function (element, finishCallback, startCallback)
3433
{
@@ -72,11 +71,10 @@ utils.slideUp = function (element, finishCallback, startCallback)
7271
/**
7372
* Slides a element down (i.e. show a hidden element)
7473
*
75-
* @param HTMLElement element the element to slide down
76-
* @param function finishCallback function to call when the animation has
74+
* @param {HTMLElement} element the element to slide down
75+
* @param {function} finishCallback function to call when the animation has
7776
* been finished (i.e. the element is visible)
78-
* @param function startCallback function to call when the animation starts
79-
* @return void
77+
* @param {function} startCallback function to call when the animation starts
8078
*/
8179
utils.slideDown = function (element, finishCallback, startCallback)
8280
{
@@ -126,8 +124,9 @@ utils.slideDown = function (element, finishCallback, startCallback)
126124
/**
127125
* Checks whether a element is visible or not
128126
*
129-
* @param HTMLElement element the element to check
130-
* @return boolean TRUE when the element is visible, FALSE otherwise
127+
* @param {HTMLElement} element the element to check
128+
*
129+
* @return {bool} TRUE when the element is visible, FALSE otherwise
131130
*/
132131
utils.isElementVisible = function (element)
133132
{

pico-theme.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
api_version: 3 # Use Pico's latest API version for themes
2+
3+
meta: # Register meta headers used by this theme
4+
Logo: logo # The URL to your website's logo (value is passed to Pico's "url" Twig filter)
5+
Tagline: tagline # Your website's tag line, shown right below your site title (supports Markdown)
6+
Social: social # A list of social icons that will be shown in your website's footer;
7+
# You must specify a "title", "url" and "icon" per entry
8+
9+
twig_config: # Twig template engine config
10+
autoescape: html # Let Twig escape variables by default
11+
strict_variables: false # If set to true, Twig will bail out when unset variables are being used
12+
charset: utf-8 # The charset used by Twig templates
13+
14+
widescreen: false # Use more horicontal space (i.e. make the site container wider)

0 commit comments

Comments
 (0)