You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice I am *not* copying ``syntax.css``? That's because Nikola handles that styles for syntax highlighting
193
+
Notice I am *not* copying ``syntax.css``? That’s because Nikola handles that styles for syntax highlighting
195
194
in a particular way, using a setting called ``CODE_COLOR_SCHEME`` where you can configure
196
195
what color scheme the syntax highlighter uses. You can use your own ``assets/css/code.css`` if you
197
-
don't like the provided ones.
196
+
don’t like the provided ones.
198
197
199
-
But how do I tell **our** lanyon theme to use those CSS files instead of whatever it's using now?
200
-
By giving our theme its own base_helper.tmpl
198
+
But how do I tell **our** lanyon theme to use those CSS files instead of whatever it’s using now?
199
+
By giving our theme its own base_helper.tmpl.
201
200
202
-
That file is a **template** used to generate parts of the pages. It's large and complicated but we don't need to change a lot of it. First, get it from `Nikola's source code <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_helper.tmpl>`__ and put a copy in ``themes/lanyon/templates/base_helper.tmpl``::
201
+
That file is a **template** used to generate parts of the pages. It’s large and
202
+
complicated but we don’t need to change a lot of it. First, get it from
203
+
`Nikola’s source code <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_helper.tmpl>`__ and put a copy in ``themes/lanyon/templates/base_helper.tmpl``::
You may say this looks like crap. Don't worry, we are just starting :-)
251
+
You may say this looks like crap. Don’t worry, we are just starting :-)
251
252
252
253
Page Layout
253
254
-----------
254
255
255
256
This is trickier but should be no problem for people with a basic understanding of HTML and a desire to make a theme!
256
257
257
-
Lanyon's content is split in two parts: a sidebar and the rest. The sidebar looks like this (shortened for comprehension):
258
+
Lanyon’s content is split in two parts: a sidebar and the rest. The sidebar looks like this (shortened for comprehension):
258
259
259
260
.. code:: html
260
261
@@ -280,7 +281,7 @@ So, a plain body, with an input element that controls the sidebar, a div which i
280
281
Inside that, div.sidebar-item for items, and a nav with "navigational links". This is followed by the "masthead" and
281
282
the content itself, which we will look at in a bit.
282
283
283
-
If we look for the equivalent code in Nikola's side, we see this:
284
+
If we look for the equivalent code in Nikola’s side, we see this:
284
285
285
286
.. code:: html
286
287
@@ -297,9 +298,9 @@ If we look for the equivalent code in Nikola's side, we see this:
297
298
So Nikola has the "masthead" above the nav element, and uses list elements in nav instead of bare links.
298
299
Not all that different is it?
299
300
300
-
Let's make it lanyon-like! We will need 2 more templates: `base.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base.tmpl>`__ and `base_header.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_header.tmpl>`__. Get them and put them in your ``themes/lanyon/templates`` folder.
301
+
Let’s make it lanyon-like! We will need 2 more templates: `base.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base.tmpl>`__ and `base_header.tmpl <https://github.com/getnikola/nikola/blob/master/nikola/data/themes/base/templates/base_header.tmpl>`__. Get them and put them in your ``themes/lanyon/templates`` folder.
301
302
302
-
Let's look at ``base.tmpl`` first. It's short and nice, it looks like a webpage without
303
+
Let’s look at ``base.tmpl`` first. It’s short and nice, it looks like a webpage without
303
304
all the interesting stuff:
304
305
305
306
.. code:: html+mako
@@ -377,13 +378,15 @@ So, first, lets change that base template to be more lanyon-like:
Also, the accessibility link on top is visible when it should not. That's because we removed "theme.css" from the base theme, and with it, we lost a couple of classes. We can add them in lanyon.css, along with others used by other
516
+
Also, the accessibility link on top is visible when it should not. That’s
517
+
because we removed ``theme.css`` from the base theme, and with it, we lost a
518
+
couple of classes. We can add them in ``lanyon.css``, along with others used by other
One clear problem is that the title "Lanyon A Jekyll theme" is set in the theme itself. We don't do that sort of things
575
-
in Nikola, we have settings for that. So, let's use it. There is a ``html_site_title`` function in ``base_helper.tmpl`` which is just the thing. So we change base.tmpl to use it:
581
+
One clear problem is that the title "Lanyon · A Jekyll theme" is set in the
582
+
theme itself. We don’t do that sort of thing in Nikola, we have settings for
583
+
that. So, let’s use them. There is a ``html_site_title`` function in
584
+
``base_helper.tmpl`` which is just the thing. So we change base.tmpl to use it:
576
585
577
586
.. code:: html+mako
578
587
@@ -583,18 +592,20 @@ in Nikola, we have settings for that. So, let's use it. There is a ``html_site_t
583
592
</div>
584
593
</div>
585
594
586
-
That's a H1 instead of a H3 like Lanyon does, but hey, it's the right thing to do. If you want to go with an H3, just
595
+
That’s a ``<h1>`` instead of a ``<h3>`` like Lanyon does, but hey, it’s the
596
+
right thing to do. If you want to go with an ``<h3>>`, just
587
597
change ``html_site_title`` itself.
588
598
589
-
And now we more or less have the correct page layout and styles. Except for a rather large thing...
599
+
And now we more or less have the correct page layout and styles. Except for a
600
+
rather large thing…
590
601
591
602
Typography
592
603
----------
593
604
594
605
You can see in the previous screenshot that text still looks quite different in our port: Serif versus Sans-Serif
595
606
content, and the titles have different colors!
596
607
597
-
Let's start with the titles. Here's how they look in Lanyon:
608
+
Let’s start with the titles. Here’s how they look in Lanyon:
598
609
599
610
.. code:: html
600
611
@@ -619,9 +630,11 @@ So, it looks like we will have to fix ``html_site_title`` after all:
619
630
</h3>
620
631
</%def>
621
632
622
-
As for the actual content, that's not in any of the templates we have seen so far. The page you see is an
623
-
"index.tmpl" page, which means it's a list of blog posts shown one below the other. Obviously it's not doing
624
-
things in the way the Lanyon CSS expects it to. Here's the original, which you can find in Nikola's source
633
+
As for the actual content, that’s not in any of the templates we have seen so far. The page you see is an
634
+
"index.tmpl" page, which means it’s a list of blog posts shown one below the
635
+
other. Obviously it’s not doing
636
+
things in the way the Lanyon CSS expects it to. Here’s the original, which you
637
+
can find in Nikola’s source
625
638
code:
626
639
627
640
.. code:: html+mako
@@ -708,14 +721,14 @@ the Lanyon original:
708
721
709
722
Some of the typography problems were caused by loading ``lanyon.css`` and ``poole.css`` in the wrong order all the way back at the beginning of this tutorial.
Doing the same for layout-reverse, sidebar-overlay and the rest is left as an excercise for the reader.
790
+
Doing the same for layout-reverse, sidebar-overlay and the rest is left as an exercise for the reader.
778
791
779
792
Bundles
780
793
-------
@@ -795,6 +808,6 @@ from a CDN and others from a bundle. This is complicated and probably not worth
795
808
The End
796
809
-------
797
810
798
-
And that's it, that's a whole theme. Eventually, once people start using it, they will notice small broken details, which will need handling one at a time.
811
+
And that’s it, that’s a whole theme. Eventually, once people start using it, they will notice small broken details, which will need handling one at a time.
799
812
800
813
This theme should be available in http://themes.getnikola.com#lanyon and you can see it in action at https://themes.getnikola.com/v7/lanyon/index.html
0 commit comments