swiftfire-jekyll-theme 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +23 -0
  3. data/README.md +107 -0
  4. data/_data/cblocks.yml +31 -0
  5. data/_data/setup.yml +135 -0
  6. data/_data/text-for.yml +53 -0
  7. data/_includes/account-menus.html +82 -0
  8. data/_includes/banner-area.html +57 -0
  9. data/_includes/banner-icon.html +23 -0
  10. data/_includes/banner-title-area.html +30 -0
  11. data/_includes/cblock-row.html +18 -0
  12. data/_includes/cblock.html +20 -0
  13. data/_includes/disqus-comments.html +39 -0
  14. data/_includes/footer.html +16 -0
  15. data/_includes/google-analytics.html +21 -0
  16. data/_includes/head.html +74 -0
  17. data/_includes/menubar-icon.html +23 -0
  18. data/_includes/menubar.html +487 -0
  19. data/_includes/secondary-column.html +37 -0
  20. data/_includes/tertiary-column.html +8 -0
  21. data/_includes/vertical-menu.html +378 -0
  22. data/_includes/widgets/browser-info.html +16 -0
  23. data/_includes/widgets/categories.html +32 -0
  24. data/_includes/widgets/cookie-consent.html +21 -0
  25. data/_includes/widgets/older-posts.html +71 -0
  26. data/_includes/widgets/recent-posts.html +24 -0
  27. data/_includes/widgets/social-media-res/icon-github.html +7 -0
  28. data/_includes/widgets/social-media-res/icon-github.svg +1 -0
  29. data/_includes/widgets/social-media-res/icon-twitter.html +7 -0
  30. data/_includes/widgets/social-media-res/icon-twitter.svg +1 -0
  31. data/_includes/widgets/social-media.html +29 -0
  32. data/_includes/widgets/subscribe.html +18 -0
  33. data/_includes/widgets/youtube-player.html +38 -0
  34. data/_layouts/banner-layout.html +1 -0
  35. data/_layouts/category-page.html +51 -0
  36. data/_layouts/content-blocks.html +6 -0
  37. data/_layouts/default.html +152 -0
  38. data/_layouts/home.html +22 -0
  39. data/_layouts/page.html +30 -0
  40. data/_layouts/post.html +20 -0
  41. data/_sass/classic-jekyll-theme.scss +1178 -0
  42. data/_sass/classic/_banner-area.scss +552 -0
  43. data/_sass/classic/_body.scss +15 -0
  44. data/_sass/classic/_columns.scss +122 -0
  45. data/_sass/classic/_custom.scss +138 -0
  46. data/_sass/classic/_footer.scss +31 -0
  47. data/_sass/classic/_menubar.scss +530 -0
  48. data/_sass/classic/_normalize-override.scss +22 -0
  49. data/_sass/classic/_normalize.scss +447 -0
  50. data/_sass/classic/_page.scss +12 -0
  51. data/_sass/classic/_post.scss +10 -0
  52. data/_sass/classic/_swiftfire.scss +54 -0
  53. data/_sass/classic/_syntax-highlighting.scss +71 -0
  54. data/_sass/classic/_theme-internal.scss +37 -0
  55. data/_sass/classic/_theme-library.scss +85 -0
  56. data/_sass/classic/_vertical-menu.scss +252 -0
  57. data/_sass/classic/_widgets.scss +88 -0
  58. data/assets/img/banner-area-layout.png +0 -0
  59. data/assets/img/cog-wheels-120x68.png +0 -0
  60. data/assets/img/cog-wheels-240x135.png +0 -0
  61. data/assets/img/cog-wheels-30x17.png +0 -0
  62. data/assets/img/cog-wheels-60x43.png +0 -0
  63. data/assets/img/column-panel-layout.png +0 -0
  64. data/assets/img/test-pattern-110x83.png +0 -0
  65. data/assets/img/test-pattern-1280x800.png +0 -0
  66. data/assets/img/test-pattern-220x165.png +0 -0
  67. data/assets/img/test-pattern-55x42.png +0 -0
  68. data/assets/img/test-pattern-640x400.png +0 -0
  69. data/assets/img/top-level-layout.png +0 -0
  70. data/assets/js/cookieconsent.min.js +1 -0
  71. data/assets/main.scss +9 -0
  72. data/assets/templates/comment-section.sf.html +137 -0
  73. data/assets/templates/email-verification-text.sf.html +6 -0
  74. data/assets/templates/request-new-password-text.sf.txt +7 -0
  75. data/icons/android-chrome-192x192.png +0 -0
  76. data/icons/apple-touch-icon.png +0 -0
  77. data/icons/browserconfig.xml +9 -0
  78. data/icons/favicon-16x16.png +0 -0
  79. data/icons/favicon-32x32.png +0 -0
  80. data/icons/favicon.ico +0 -0
  81. data/icons/manifest.json +13 -0
  82. data/icons/mstile-150x150.png +0 -0
  83. data/icons/safari-pinned-tab.svg +14 -0
  84. data/pages/about/about.md +15 -0
  85. data/pages/account/comment-edit.sf.md +60 -0
  86. data/pages/account/comment-review.sf.md +80 -0
  87. data/pages/account/email-verification-failed.sf.md +11 -0
  88. data/pages/account/email-verification-success.sf.md +7 -0
  89. data/pages/account/error.sf.md +13 -0
  90. data/pages/account/forgot-password-continue.sf.md +9 -0
  91. data/pages/account/forgot-password.sf.md +25 -0
  92. data/pages/account/login.sf.md +19 -0
  93. data/pages/account/not-allowed.sf.md +7 -0
  94. data/pages/account/register-continue.sf.md +11 -0
  95. data/pages/account/register.sf.md +30 -0
  96. data/pages/account/request-new-password-failed.sf.md +13 -0
  97. data/pages/account/set-new-password-success.sf.md +7 -0
  98. data/pages/account/set-new-password.sf.md +25 -0
  99. data/pages/categories/classic.md +10 -0
  100. data/pages/categories/example.md +10 -0
  101. data/pages/categories/jekyll.md +10 -0
  102. data/pages/categories/update.md +10 -0
  103. data/pages/classic/01-features.md +36 -0
  104. data/pages/classic/02-setup.md +113 -0
  105. data/pages/classic/03-pages-and-posts.md +25 -0
  106. data/pages/classic/04-posts.md +18 -0
  107. data/pages/classic/05-menus.md +118 -0
  108. data/pages/classic/06-categories.md +38 -0
  109. data/pages/classic/07-terminology.md +35 -0
  110. data/pages/classic/08-versioning.md +23 -0
  111. data/pages/classic/09-problems.md +25 -0
  112. data/pages/contact/contact.md +18 -0
  113. data/pages/cookie-consent/cookie-consent.md +7 -0
  114. data/pages/download/download.md +10 -0
  115. data/pages/jekyll/01-jekyll.md +42 -0
  116. data/pages/jekyll/02-speed.md +88 -0
  117. data/pages/jekyll/03-ruby.md +19 -0
  118. data/pages/jekyll/04-cron-job.md +163 -0
  119. data/pages/layouts/banner-main.md +36 -0
  120. data/pages/layouts/blocks.md +11 -0
  121. data/pages/layouts/landing-page.md +21 -0
  122. data/pages/layouts/no-sec-no-ter.md +28 -0
  123. data/pages/layouts/sec-left-no-ter.md +28 -0
  124. data/pages/layouts/sec-left-ter-right.md +28 -0
  125. data/pages/layouts/sec-right-no-ter.md +28 -0
  126. data/pages/layouts/sec-right-ter-left.md +28 -0
  127. data/pages/menus/external-url.md +28 -0
  128. data/pages/menus/landing-page.md +8 -0
  129. data/pages/menus/submenu-subsections.md +72 -0
  130. data/pages/menus/submenu1.md +22 -0
  131. data/pages/menus/submenu2.md +21 -0
  132. data/pages/menus/submenu3.md +47 -0
  133. data/pages/menus/submenu4.md +36 -0
  134. data/pages/menus/subsubmenu3-1.md +21 -0
  135. data/pages/menus/subsubmenu3-2.md +21 -0
  136. data/pages/menus/subsubmenu4-1.md +31 -0
  137. data/pages/menus/subsubmenu4-2.md +31 -0
  138. metadata +269 -0
@@ -0,0 +1,38 @@
1
+ ---
2
+ layout: page
3
+ title: "Categories in classic"
4
+ date: 2017-12-15
5
+ menuInclude: yes
6
+ menuTopTitle: Classic
7
+ menuSubs:
8
+ - title: About Categories
9
+ index: 6
10
+ excerpt: "An excerpt is used as the page description and can be up to 160 characters long..."
11
+ ---
12
+
13
+ ### Category pages
14
+
15
+ Category pages can be created with a little assistance of the web designer. To kick of the creation of a category page, create a page with the `layout` set to _category-page_. Also add a `title` that is set to the name of the category for which the page is created.
16
+
17
+ An example can be seen in the _pages/categories/classic.md_ file:
18
+
19
+ ---
20
+ layout: category-page
21
+ title: classic
22
+ ---
23
+
24
+ All other content in a category generation file is ignored.
25
+
26
+ ### Category Menu Item
27
+
28
+ To enable the creation of a category menu item set the `site.data.setup.generate-categories-menu parameter` to _yes_. This will create a drop-down menu entry with the names of the categories for which pages were generated.
29
+
30
+ PS: The name of the categories menu item can be configured in `site.data.text-for.tCategories`.
31
+
32
+ ### Category widget
33
+
34
+ As an alternative to the menu a widget is available that can be included somewhere to have access to the category pages.
35
+
36
+ ### Widget or Menu
37
+
38
+ Using the categories menu is not possible when the drop-down menus are disabled (by setting `site.data.setup.drop-down-menu` to _no_). In that case the widget is the only way to access the categories pages.
@@ -0,0 +1,35 @@
1
+ ---
2
+ layout: page
3
+ title: Terminology
4
+ date: 2017-12-15
5
+ tertiary-column: none
6
+ menuInclude: yes
7
+ menuTopTitle: Classic
8
+ menuSubs:
9
+ - title: Terminology
10
+ index: 7
11
+ excerpt: The terminology used throughout the classic-jekyll-theme code base
12
+ ---
13
+ When configuring the many options it is necessary to have a good view of the names used in the layout.
14
+
15
+ At the top level there are the following visible elements:
16
+
17
+ ![top-level elements]({{ "/assets/img/top-level-layout.png" | relative_url }}){:.image-centered}
18
+
19
+ Of these the footer-separator and footer have no further internal decomposition.
20
+
21
+ The banner-area is the most complex as is displayed below. The column-panel is the main content panel and is divided into the following sub-components:
22
+
23
+ ![column elements]({{ "/assets/img/column-panel-layout.png" | relative_url }}){:.image-centered}
24
+
25
+ The secondary-column and tertiary-column may be swapped in place, or disabled altogether.
26
+
27
+ The banner-area is build from the following components:
28
+
29
+ ![column elements]({{ "/assets/img/banner-area-layout.png" | relative_url }}){:.image-centered}
30
+
31
+ Of these elements the menubar and menubar-bottom-separator may be made invisible by tapping or clicking the menu-symbol. The elements in the banner itself may be arranged differently, or may be absent.
32
+
33
+ All elements (except the primary-column) can be disabled.
34
+
35
+ It is also possible to insert an icon into the menubar and disable the banner. This means that the banner-area then only consist of the menubar and its separators (which can also be disabled).
@@ -0,0 +1,23 @@
1
+ ---
2
+ layout: page
3
+ title: Versioning
4
+ date: 2017-12-20
5
+ tertiary-column: none
6
+ menuInclude: yes
7
+ menuTopTitle: Classic
8
+ menuSubs:
9
+ - title: Versioning
10
+ index: 8
11
+ excerpt: The versioning approach for Classic
12
+ ---
13
+ Classic uses the versioning approach Major.Minor.Patch.
14
+
15
+ However due to the nature of theme's the interpretation of these number is slightly different.
16
+
17
+ Classic will update the _Patch_ number when adding to the content area's of the theme. I.e. posts or pages. There is no need to follow these updates closely for your own theme.
18
+
19
+ Classic will update the _Minor_ number when bugfixes or minor additions are made. A list of changed files will be provided. It may be necessary to re-apply changes that were made to the theme's files at your end.
20
+
21
+ Classic will update the _Major_ number when significant additions have been made. The difference between minor and major additions is entirely subjective.
22
+
23
+ Backwards compatibility with previously used YAML tags is a very important driver for further development.
@@ -0,0 +1,25 @@
1
+ ---
2
+ layout: page
3
+ title: Problems & Workarounds
4
+ date: 2018-02-01
5
+ tertiary-column: none
6
+ menuInclude: yes
7
+ menuTopTitle: Classic
8
+ menuSubs:
9
+ - title: Problems and workarounds
10
+ index: 9
11
+ excerpt: A discussion of problems that might occur and possible work arounds
12
+ ---
13
+ ## Issue 16: Youtube-player widget shows video on top of banner for top-fixed banner layout.
14
+
15
+ Due to the way youtube videos are displayed it is not possible to use the youtube-player.html widget when the banner position is set to top-fixed in the setup.yml file.
16
+
17
+ To include youtube video's use the iframe directly like this:
18
+
19
+ ~~~~
20
+ <iframe src="https://www.youtube.com/embed/video-id" width="100px" height="56.25px"></iframe>
21
+ ~~~~
22
+
23
+ Of course the width and height parameters should be scaled to whatever size is required. Multiples of the values given will result in a HD-aspect ratio.
24
+
25
+ If the youtube-player widget is used for `banner-position: top-fixed`, the site and videos will work as normal. The only problem is that on scrolling the video's may appear to float over the banner (and menubar).
@@ -0,0 +1,18 @@
1
+ ---
2
+ layout: page
3
+ title: Contact
4
+ menuInclude: true
5
+ menuTopTitle: Contact
6
+ menuTopIndex: 99
7
+ excerpt: Contact information for this site.
8
+ tertiary-column: none
9
+ ---
10
+
11
+ This is a placeholder in the theme.
12
+
13
+ Edit this content in `pages/contact/contact.md`.
14
+
15
+ But you can contact us at:
16
+
17
+ - Before the at sign: rien
18
+ - After the at sign: balancingrock.nl
@@ -0,0 +1,7 @@
1
+ ---
2
+ layout: default
3
+ title: Cookie policy
4
+ excerpt: Cookie policy information
5
+ ---
6
+
7
+ In compliance with EU law we inform you that this website uses cookies to etc etc.
@@ -0,0 +1,10 @@
1
+ ---
2
+ layout: page
3
+ title: Download
4
+ menuInclude: yes
5
+ menuLink: yes
6
+ menuTopTitle: Download
7
+ menuTopIndex: 1000
8
+ excerpt: Where to get Classic Jekyll Theme.
9
+ ---
10
+ You can get the Classic-Jekyll-Theme at either [rubygems.org](https://rubygems.org/gems/classic-jekyll-theme) or from [github](https://github.com/Balancingrock/classic-jekyll-theme).
@@ -0,0 +1,42 @@
1
+ ---
2
+ layout: page
3
+ title: Jekyll Static Website Generator
4
+ date: 2017-12-20
5
+ menuInclude: yes
6
+ menuTopTitle: Jekyll
7
+ menuTopIndex: 1
8
+ menuSubs:
9
+ - title: Static generator
10
+ index: 1
11
+ tertiary-column: none
12
+ excerpt: What is Jekyll? Jekyll is a static website generator...
13
+ ---
14
+ Back in the early days of the internet websites were just a few files on a computer.
15
+
16
+ As the web became more widely used, the content became more and more 'dynamic'. This means that two visits to the same site by two different people or at two different times would no longer return the same information.
17
+
18
+ The information returned depended on the context in which is was requested.
19
+
20
+ The static pages were replaced by scripting languages and database backends. Needless to say, this increased de complexity of building and maintaining a website. To combat this, many people started to use standard products such as Wordpress.
21
+
22
+ However as good as Wordpress (and others) might be, they do not simplify the underlying structure. They merely hide it from the site-developper. Add plugins to this, and instability of the platform becomes a real possibility. I know, I lost entire websites -more than once!- because of this.
23
+
24
+ After the initial embrace of dynamic this and dynamic that, many people started to rediscover the old way of creating websites. Static websites are -as it turns out- more than enough for many small sites or blogs! Certainly with the new wave of "comment" providers like disqus.
25
+
26
+ Creating a simple website using a comments provider is still a bit of work though.
27
+
28
+ Enter the static website generator.
29
+
30
+ Static websites generators take a lot of pain out of traditional web design. And when using a theme (like this!) this becomes even easier.
31
+
32
+ Creating content is now just a matter of writing the content in a (plain) text editor, then compiling the website and uploading it (or only the changes) to the hosting provider.
33
+
34
+ Simple, neat.
35
+
36
+ Jekyll is such a static website generator.
37
+
38
+ And Classic-Jekyll-Theme is a theme that can be used with Jekyll to create beautiful sites.
39
+
40
+ For more on Jekyll, see [https://jekyllrb.com](https://jekyllrb.com)
41
+
42
+ For more on Classic, explore this website!
@@ -0,0 +1,88 @@
1
+ ---
2
+ layout: page
3
+ title: Compilation Speed
4
+ date: 2017-12-20
5
+ menuInclude: yes
6
+ menuTopTitle: Jekyll
7
+ menuSubs:
8
+ - title: Compilation speed
9
+ index: 2
10
+ sub:
11
+ - title: Jekyll
12
+ anchorId: jekyll
13
+ index: 1
14
+ - title: Classic
15
+ anchorId: classic
16
+ index: 2
17
+ tertiary-column: none
18
+ excerpt: Speed hints for Jekyll and Classic
19
+ ---
20
+ {:.anchor}
21
+ ## Jekyll Speed Hints {#jekyll}
22
+
23
+ Once the site starts to grow, compilation speed can become an issue. Jekyll is not all that fast, and Classic can slow down things even more.
24
+
25
+ The main culprit for Classic's performance is the creation of the menubar. More on that below. First some general speed hints about Jekyll.
26
+
27
+ ### Knowledge is power
28
+
29
+ Turn on the profiler. That shows how much time is spend where.
30
+
31
+ bundle exec jekyll serve --profile
32
+
33
+ will do the trick.
34
+
35
+ ### Exclude content that must not be compiled
36
+
37
+ In the `_config.yml` exclude the directories that contains stuff that can be copied and stuff that simply does not need to be compiled.
38
+
39
+ Example:
40
+
41
+ keep_files: [assets, icons]
42
+ exclude: [README.md, raw-material]
43
+
44
+ Use `keep_files` to simply copy over those files. Use `exclude` to complete ignore the files.
45
+
46
+ ### Incremental build
47
+
48
+ Jekyll offers an incremental build option. This option does not seem to work pre Jekyll 3.7
49
+
50
+ bundle exec jekyll serve --incremental
51
+
52
+ Note that the _home_ page is not rebuild when using _incremental_. To see the changes that are made to a post or page, go to that post/page directly.
53
+
54
+ If you find any strange effects/artefacts, be sure to turn this off first.
55
+
56
+ ### Build only the last post
57
+
58
+ This helps when writing a new post:
59
+
60
+ bundle exec jekyll serve --limit_posts 1
61
+
62
+ However once the post is ready to be published, it is still necessary to recompile the entire site to ensure that all webpages properly reflect that a new post was added.
63
+
64
+ {:.anchor}
65
+ ## Classic Speed Hints {#classic}
66
+
67
+ ### Use fast-content-build
68
+
69
+ Setting `fast-content-build` (in _setup.yml_) to _yes_ will disable the creation of the menubar, the vertical menu, categories widget, older-posts widget and the recent-posts widget.
70
+
71
+ The resulting speed increase is rather large, but of course the created site is not ready for publication. Still it can be advantageous when creating content where the browser window is "reloaded" frequently to view the changes that were made.
72
+
73
+ To prevent accidentally leaving this setting active, this setting is always disregarded when `jekyll.environment` is set to _production_.
74
+
75
+ ### Use a separate banner-area file
76
+
77
+ By default the menubar is generated in-line for each page/post. However the menubar generation process is the biggest time consumer when creating a page/post.
78
+
79
+ It is possible to create the menubar in a separate file and to load that file whenever necessary (using a simple line of Javascript). That increases the speed of compilation but degrades the user experience. The degradation is two fold: the browser must make multiple fetches which will take longer. However that is in our experience not really an issue. The bigger drawback is that the user is no longer given information about which menu item is selected.
80
+
81
+ With the in-line menubar the menu item for the currently visible page is highlighted.
82
+
83
+ When the menubar is generated in a separate file this is no longer possible.
84
+
85
+ If this is no problem, then the menubar (and banner) can be separated by setting the `use-separate-banner-menubar-file` parameter (in _setup.yml_) to 'yes'
86
+
87
+ Alternatively it is of course also possible to set this parameter to 'yes' during development and to 'no' for deployment.
88
+
@@ -0,0 +1,19 @@
1
+ ---
2
+ layout: page
3
+ title: The Ruby Environment
4
+ date: 2017-12-20
5
+ menuInclude: yes
6
+ menuTopTitle: Jekyll
7
+ menuSubs:
8
+ - title: Ruby environment
9
+ index: 3
10
+ tertiary-column: none
11
+ excerpt: Ruby and versioning hell
12
+ ---
13
+ Versioning is a major headache for people doing more than 1 project. It is not called "Versioning Hell" for nothing.
14
+
15
+ Ruby is no exception. And using Jekyll for website development may in turn cause problems with other Ruby based projects.
16
+
17
+ We use [rbenv](https://github.com/rbenv/rbenv) to solve this problem.
18
+
19
+ With [rbenv](https://github.com/rbenv/rbenv) any Ruby based project can run in its own versioning environment. Recommended!
@@ -0,0 +1,163 @@
1
+ ---
2
+ layout: page
3
+ title: "Cron jobs: create websites periodically"
4
+ date: 2018-02-05
5
+ menuInclude: yes
6
+ menuTopTitle: Jekyll
7
+ menuSubs:
8
+ - title: Create website from git periodically and automatically
9
+ index: 4
10
+ tertiary-column: none
11
+ excerpt: How to set up the daily creation of a website with jekyll and git...
12
+ ---
13
+ When maintaining a website it is common to want to add posts and pages on a regular basis to stimulate regular visits of users. A static website generator makes this harder, but with a little extra effort it is possible to show a new post or page on predefined dates. (Note that the classic-jekyll-theme is needed to have this feature apply to pages as well as posts. Standard Jekyll wil only do dated posts releases)
14
+
15
+ This is the workflow this example aims for:
16
+
17
+ - Create a page or post on a local machine.
18
+ - Verify that the layout of the site (on the local machine) is as desired.
19
+ - Check in the changes on the local machine into the local git repository.
20
+ - Push the local git to the git-server.
21
+
22
+ And have the website on the next day reflect the changes that were made. If changes were made for a future release date, they should only appear on and after the date for which they were written.
23
+
24
+ ## Before we start
25
+
26
+ The method described here only works if we have control of the server.
27
+
28
+ It does not work for github hosted sites, though it should be possible to achieve the same result with Github if the cron job does not kick-off the jekyll-build process, but a git-push of an automatically generated file (to github).
29
+
30
+ The example is given for macOS, but should be easy to replicate for other platforms.
31
+
32
+ ## The setup
33
+
34
+ The setup is simple: the machine that hosts the website has Jekyll and git-server installed on it. It can be the same machine that is used to create the content, but that is not necessary. One of the side benefits of this approach is that it is easy to update the website from anywhere in the world. Keep in mind though that it is important to use the same version of Jekyll and the ruby environment on all machines.
35
+
36
+ What we will do:
37
+
38
+ 1. Create a git-server repository on the server that contains the (file for the) website.
39
+ 1. Create a git working repository on the server that is used to generate the actual website.
40
+ 1. Create a job on the server that checks out the website from the git-server repository into the working repository, compiles the website with Jekyll and then copies the content of `_site` to the website directory used by the server.
41
+
42
+ And that is all there is to it. Once this is done, we can update the website from any place that has `push` rights to the git-server repository.
43
+
44
+ To be clear, there are three website directories involved:
45
+
46
+ 1. The server website directory. This is the directory that the webserver uses to serve the incoming HTTP requests.
47
+ 1. The git-server website, this is a directory that contains all the files to build the website. It is identical in structure to the directory that is created by `jekyll new`.
48
+ 1. And lastly a working directory (with git repository) that is used to create the files to be copied to the server website directory. This directory will be synchronised with the git-server directory when the website files are build.
49
+
50
+ ## The steps
51
+
52
+ ### Create git-server repository
53
+
54
+ I use macOS Xcode-Server to create a git-server repository.
55
+
56
+ Start 'Server' and select 'Xcode', then choose the 'Repositories' tab and create the repository.
57
+
58
+ If you don't have macOS-Server and Xcode-Server installed, please google "git server macOS" for hints about how to setup a git server on the mac.
59
+
60
+ For this example I will assume a site called 'mysite' and that the git-server repository has the same name.
61
+
62
+ ### Create a directory to use as a working directory for the cron script
63
+
64
+ Any location will work, this example uses: `/Users/rien/Documents/Websites/mysite`. Of course your user name and site name will be different.
65
+
66
+ Goto the `/Websites` directory and create the git repository that will be used by the script.
67
+
68
+ git clone <<path-to-repo>>
69
+
70
+ The <<path-to-repo>> should be the path to the git-server repository and end in 'mysite' or 'mysite.git'
71
+
72
+ This command also creates the directory `/mysite`
73
+
74
+ ### Create the update script
75
+
76
+ This script is located at the user level (in this case: `Users/rien`) and lets call it `mysite-daily-update.script`.
77
+
78
+ #! /bin/bash
79
+ echo "$(date) start"
80
+ cd /Users/rien/Documents/Websites/mysite
81
+ echo "git pull"
82
+ git pull origin
83
+ echo "bundle exec jekyll build"
84
+ rm Gemfile.lock
85
+ JEKYLL_ENV=production /Users/rien/.rbenv/shims/bundle exec jekyll build
86
+ echo "sync site"
87
+ rsync -av _site/ /Library/Server/Web/Data/Sites/mysite
88
+ echo "$(date) ready"
89
+
90
+ What happens:
91
+
92
+ - The bash shell is used
93
+ - The start time is logged to a console
94
+ - The working directory is changed to the directory where the cloned repository is
95
+ - The working repository is updated from the main site repository
96
+ - The Gemfile.lock is removed (I believe this is not really necessary, a leftover from experimenting)
97
+ - Jekyll compiles the site (the full path to `bundle` must be specified because the regular login profile is not executed in a cron job)
98
+ - The site is copied to the directory where the server expects it.
99
+ - The end time is logged to a console
100
+
101
+ The path in the `rsync` command must of course be the path to the directory where the website is hosted.
102
+
103
+ Note that when the website is being used the users may experience an inconsistent website for a very short time. For the type of updates that are targeted with this approach (page & post updates) this should not pose a problem. But when a website is completely redesigned it may be unacceptable. In that case a proper shutdown of the server is necessary before the rsync command is issued and a restart of the server afterwards.
104
+
105
+ Important: Make the script executable!
106
+
107
+ chmod +x mysite-daily-update.script`
108
+
109
+ ### Create the cron job specification
110
+
111
+ In the directory `~/Library/LaunchAgents` create a file with the name `com.mysite.plist`. Of course a different reverse-url notation will be needed for a different site.
112
+
113
+ This file should contain the following:
114
+
115
+ ```xml
116
+ <?xml version="1.0" encoding="UTF-8"?>
117
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
118
+ <plist version="1.0">
119
+ <dict>
120
+ <key>Label</key>
121
+ <string>com.mysite.daily-update</string>
122
+ <key>StandardOutPath</key>
123
+ <string>/Users/rien/mysite-daily-update.log</string>
124
+ <key>StandardErrorPath</key>
125
+ <string>/Users/rien/mysite-daily-update.error.log</string>
126
+ <key>Program</key>
127
+ <string>/Users/rien/mysite-daily-update.script</string>
128
+ <key>StartCalendarInterval</key>
129
+ <dict>
130
+ <key>Hour</key>
131
+ <integer>00</integer>
132
+ <key>Minute</key>
133
+ <integer>01</integer>
134
+ </dict>
135
+ </dict>
136
+ </plist>
137
+ ```
138
+
139
+ One thing to notice is that this specification also tells the OS to create an error and a log file. These files are written to the users root directory and can be examined for error messages.
140
+
141
+ The `Hour` and `Minute` keys and their values specify the time when the script should be executed. Take note of this because when you are in the habit of switching off the server at certain times, this may result in missing the site-generation for that day.
142
+
143
+ Btw, a good resource for the capabilities and configuration of the launchd can be found at: [http://www.launchd.info](http://www.launchd.info).
144
+
145
+ ### Load the cron job (manually)
146
+
147
+ The job will be loaded automatically at startup. But right now you will need to load the job by hand:
148
+
149
+ launchctl load ~/Library/LaunchAgents/com.mysite.plist
150
+
151
+ Most likely you will also want to test the script, that can be done with:
152
+
153
+ launchctl start com.mysite.daily-update
154
+
155
+ The first couple of times, make sure to check for an error log in the `StandardErrorPath`. (Which in this example is the user home directory)
156
+
157
+ For completion, there are also the `unload` and `stop` options for `launchctl`. Only when the plist file is changed does one need to unload it.
158
+
159
+ ## In closing
160
+
161
+ With the above information it should be possible to set up a daily re-generation of the site, and to automatically upload it to the appropriate server directory.
162
+
163
+ If a dedicated server is used and the git-server directory is accessable from outside, this is also a very convenient method to create pages and posts from outside your local domain. I.e. when travelling. It is even possible to use this to contribute to the site by multiple authors.