simple-gh-pages-theme 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7b807d8c650f10418abcc0c706ffd1c650507409b2ef50a4a6f278333a22622
4
- data.tar.gz: 973d492bd1fa490a39071abfbc1bcbd1454caa6064be5f62194c99d3e8b84d9d
3
+ metadata.gz: f5144f620dc2053c7cb8f8edeee17d6c2a5f2d85ac1105802515b6a5c5d8aea5
4
+ data.tar.gz: 83bf55b657497ff342992c50c899deb474163cb748aada682c65b3c5de0af5b6
5
5
  SHA512:
6
- metadata.gz: 47549fede30cf7138a9393174e48757585a4d96d1fa79eee44ef12dfa30945cd028b1f95388e42861106d42238a6fe09c41ef25fcae0040af9deb9928c7f893d
7
- data.tar.gz: ce01829d02aa82aa0abc54af35291121ac55c47239824ade736ce189a75a480b5dc3a352a514ce98286f8895c7e72f3d5dbf9743f3fd5beee058439fbcc2eed8
6
+ metadata.gz: c6c392ca3aa4cc855bd4c3e21b39b3ea1977492d54618c94e08b51055527941398721b6723d52c1ab16e17d31c4610dd0cc4626b554c0a31bb3900a21c1b1f59
7
+ data.tar.gz: 5820facac70b0de40e32b5b4e9498ccf0fdb096e728813fc02e55f157695feec3ac8e52776409773707a3e3dcaecac9befc552d57573170942a469a900c3f462
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <table>
4
4
  <tr><td>
5
- <img width="500" alt="empty default" src="https://user-images.githubusercontent.com/5443727/229302809-750132e5-d461-4ec8-a38a-ccdc62b3b72e.png">
5
+ <img width="500" alt="after installing the theme" src="https://user-images.githubusercontent.com/5443727/229901057-23be4caa-0c70-46c1-aa83-d60cbb1220ba.png">
6
6
  </td><td>
7
7
  <img width="500" alt="jordiwippert.nl" src="https://user-images.githubusercontent.com/5443727/229302812-d481eb40-b0ca-49cd-95d5-c7fef5228b7a.png">
8
8
  </td>
@@ -11,97 +11,68 @@
11
11
  simple-gh-pages-theme, after install and first post setup
12
12
  </td>
13
13
  <td>
14
- in-use
14
+ in-use: https://jordiwippert.nl
15
15
  </td>
16
16
  </tr>
17
17
  </table>
18
18
 
19
- ## Installation
20
-
21
- Add this line to your Jekyll site's `Gemfile`:
19
+ ## Quick installation
20
+ ```shell
21
+ # 0. To create a new Jekyll site:
22
+ jekyll new <SITENAME>
23
+ cd <SITENAME>
24
+ ```
22
25
  ```ruby
26
+ # 1. Add this line to your Jekyll site's `Gemfile`:
23
27
  gem "simple-gh-pages-theme"
24
28
  ```
25
-
26
- And add this line to your Jekyll site's `_config.yml`. Remove/disable possibly already enabled themes:
27
29
  ```yaml
30
+ # 2. Add this line to your Jekyll site's `_config.yml`. Remove/disable possibly already enabled themes:
28
31
  theme: simple-gh-pages-theme
29
32
  ```
30
-
31
- And then execute:
32
33
  ```shell
34
+ # 3. Execute on your command line:
33
35
  bundle
34
- OR
35
- gem install simple-gh-pages-theme
36
- ```
37
- ### !!! Important. To make the layouts work properly.
38
36
 
39
- If you created a new website (`jekyll new sitename`), you can make your pages use the layout by changing:
37
+ # 4. Run install script to create 'posts.md'
38
+ bundle exec install-theme
40
39
 
41
- - **index.markdown**:
42
- ```
43
- ---
44
- layout: index
45
- ---
46
- ```
47
- - **about.markdown**:
48
- ```
49
- ---
50
- layout: post
51
- permalink: /about.html
52
- ---
53
- ```
54
- - **posts.markdown**: (file might not exist yet)
55
- ```
56
- ---
57
- layout: posts
58
- ---
59
- ```
60
- - **404.markdown**: (file might not exist yet)
61
- ```
62
- ---
63
- layout: 404
64
- ---
40
+ # 5. When you now run your website locally on `http://localhost:4000`, it should show the theme:
41
+ bundle exec jekyll serve
65
42
  ```
66
43
 
67
44
  ## Configuration:
68
45
 
69
- See/use example config [here](https://github.com/LiveNL/simple-gh-pages-theme/blob/main/example-config.yml). Copy to `_config.yml`
46
+ All configuration options that can be overwritten can be found [here](https://github.com/LiveNL/simple-gh-pages-theme/blob/main/_config.yml).
70
47
 
71
- ## Usage
72
- ### Posts
48
+ ## Github Pages setup
73
49
 
74
- Create your posts like:
50
+ Go to `settings` > `page` in your github-pages-repository.
51
+ 1. Select source: `Deploy from a branch`
52
+ 2. Select branch: `gh-pages` (create if non-existent)
53
+ 3. Select `/docs` as folder
54
+ 4. You can now run `script/deploy`
75
55
 
56
+ ## Posts
57
+ Create your posts (files) like:
76
58
  ```
77
- docs/_posts/published/yyyy-mm-dd-postname.md
59
+ docs/_posts/yyyy-mm-dd-postname.md
78
60
  ```
79
61
 
80
- Each post can have the following options (with defaults):
81
-
82
- ```
83
- layout: post
84
- title: "Title here"
85
- image: assets/images/image.png OR https://example.com/image.png
86
- categories: [category]
87
- tags: [tag]
88
- highlight: false (if true: it will be used on about page, more here)
89
- short: false (if true: it shown in 'short' list on home page)
90
- list_post: false (if true: it shown in list on home/posts page)
62
+ Each post can have the following (metadata) options (with example values):
63
+ ```yaml
64
+ layout: post # OR page
65
+ title: "Title here" # Used for post-titles
66
+ image: assets/images/image.png # OR images on urls like: https://example.com/image.png
67
+ categories: [category] # 'category' can be anything
68
+ tags: [tag] # 'tag' can be everything
69
+ highlight: false # if true: it will listed in highlights, which can be shown with: `{% include highlights.html %}`
70
+ short: false # if true: it shown in 'short' list on home page
91
71
  ```
92
72
 
93
- ## Development
94
-
95
- To set up your environment to develop this theme, run `bundle install`.
96
-
97
- To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`.
98
-
99
- This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
100
-
101
- When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
102
-
103
73
  ## Contributing
104
- Bug reports and pull requests are welcome on GitHub at https://github.com/lvenl/simple-gh-pages-theme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
74
+
75
+ Bug reports and pull requests are welcome on GitHub at https://github.com/LiveNL/simple-gh-pages-theme. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
105
76
 
106
77
  ## License
107
78
 
data/_config.yml ADDED
@@ -0,0 +1,57 @@
1
+ theme: simple-gh-pages-theme
2
+ title: "My website"
3
+ description: "The website description"
4
+ domain: "username.github.io"
5
+ baseurl: ""
6
+ url: ""
7
+ gtag: "G-XXXXXXXXX" # (your google tag)
8
+
9
+ about:
10
+ name: Firstname Lastname
11
+ site: "https://example.com"
12
+ avatar: assets/images/image.png
13
+ email: example@example.com
14
+ socials:
15
+ twitter: https://twitter.com/example
16
+ linkedin: https://www.linkedin.com/in/example/
17
+ github: https://github.com/example
18
+ keybase: https://keybase.io/example
19
+ medium: https://medium.com/@example
20
+ stack-overflow: https://stackoverflow.com/users/xxxxxx/example
21
+
22
+ plugins:
23
+ - jekyll-archives
24
+ - jekyll-redirect-from
25
+ - jekyll-sitemap
26
+
27
+ jekyll-archives:
28
+ enabled:
29
+ - tags
30
+ - categories
31
+ layout: category-posts
32
+ permalinks:
33
+ year: "/:year/"
34
+ month: "/:year/:month/"
35
+ day: "/:year/:month/:day/"
36
+ tag: "/tag/:name/"
37
+ category: "/category/:name/"
38
+
39
+ defaults:
40
+ - scope:
41
+ path: "assets/**"
42
+ values:
43
+ sitemap: false
44
+
45
+ # Excluded items can be processed by explicitly listing the directories or
46
+ # their entries' file path in the `include:` list.
47
+ exclude:
48
+ - .sass-cache/
49
+ - .jekyll-cache/
50
+ - gemfiles/
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - node_modules/
54
+ - vendor/bundle/
55
+ - vendor/cache/
56
+ - vendor/gems/
57
+ - vendor/ruby/
data/_data/navigation.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  - name: Home
2
2
  link: /
3
3
  - name: Posts
4
- link: /posts.html
4
+ link: /posts/
5
5
  - name: About
6
- link: /about.html
6
+ link: /about/
@@ -1,12 +1,13 @@
1
1
  <table>
2
- {% assign selection = site.posts | where_exp:"post", "post.highlight == true"
3
- %} {% for post in selection %}
2
+ <!-- prettier-ignore -->
3
+ {% assign selection = site.posts | where_exp:"post", "post.highlight == true" %}
4
+ {% for post in selection %}
4
5
  <tr>
5
6
  <td>
6
7
  <h4><span class="date">{{ post.date | date: "%b '%y"}}</span></h4>
7
8
  </td>
8
9
  <td>
9
- {% if post.list_post == true %}
10
+ {% if post.layout == 'post' and post.content.size > 1 %}
10
11
  <a href="{{ post.url }}" style="text-decoration: none !important">
11
12
  <h4>&nbsp;{{ post.title }}</h4>
12
13
  </a>
@@ -6,7 +6,8 @@
6
6
  {% assign nr_of_posts = 0 %}
7
7
  {% assign cat = category | first %}
8
8
  {% assign posts = site.categories[cat] %}
9
- {% assign selection = posts | where_exp:"post", "post.list_post == true" %}
9
+ {% assign selection = posts | where_exp:"post", "post.layout == 'post'" %}
10
+ {% assign selection = selection | where_exp:"post", "post.content.size > 1" %}
10
11
  {% for post in selection %}
11
12
  {% assign nr_of_posts = nr_of_posts | plus:1 %}
12
13
  {% endfor %}
@@ -30,7 +31,8 @@
30
31
  {% assign nr_of_posts = 0 %}
31
32
  {% assign tag = tag_post | first %}
32
33
  {% assign tag_posts = site.tags[tag] %}
33
- {% assign tag_posts_selection = tag_posts | where_exp:"post", "post.list_post == true" %}
34
+ {% assign tag_posts_selection = tag_posts | where_exp:"post", "post.layout == 'post'" %}
35
+ {% assign tag_posts_selection = tag_posts_selection | where_exp:"post", "post.content.size > 1" %}
34
36
  {% for post in tag_posts_selection %}
35
37
  {% assign nr_of_posts = nr_of_posts | plus:1 %}
36
38
  {% endfor %}
@@ -6,11 +6,12 @@ title: categories
6
6
  <div class="content">
7
7
  <div class="posts-all">
8
8
  <!-- prettier-ignore -->
9
- {% assign selection = page.posts | where_exp:"post", "post.list_post == true" %}
10
- {% for post in selection %}
11
- {% include post-list-item.html %}
12
- {% assign nr_of_posts = nr_of_posts | plus:1 %}
13
- {% endfor %}
9
+ {% assign selection = page.posts | where_exp:"post", "post.layout == 'post'" %}
10
+ {% assign selection = selection | where_exp:"post", "post.content.size > 1" %}
11
+ {% for post in selection %}
12
+ {% include post-list-item.html %}
13
+ {% assign nr_of_posts = nr_of_posts | plus:1 %}
14
+ {% endfor %}
14
15
  </div>
15
16
 
16
17
  <div class="sidebar-short">
@@ -0,0 +1,4 @@
1
+ ---
2
+ layout: index
3
+ title: home
4
+ ---
data/_layouts/index.html CHANGED
@@ -6,13 +6,12 @@ title: home
6
6
  <div class="content">
7
7
  <div class="posts-top">
8
8
  <!-- prettier-ignore -->
9
- {% assign selection = site.posts | where_exp:"post", "post.list_post == true" %}
10
9
  {% assign selection = site.posts | where_exp:"post", "post.short != true" %}
11
10
  {% for post in selection limit: 5 %}
12
11
  {% include post-list-item.html %}
13
12
  {% endfor %}
14
13
  <h2 style="font-family: 'Arvo'">
15
- <a href="{{site.baseurl}}/posts.html">&#10095;&nbsp; All posts </a>
14
+ <a href="{{site.baseurl}}/posts/">&#10095;&nbsp; All posts </a>
16
15
  </h2>
17
16
  </div>
18
17
 
@@ -0,0 +1,12 @@
1
+ ---
2
+ layout: default
3
+ title: page
4
+ ---
5
+
6
+ <div class="post-content" style="width: 100%">
7
+ <div class="div-post-title title">
8
+ {{ page.title }}
9
+ <div class="line"></div>
10
+ </div>
11
+ {{ content }}
12
+ </div>
data/_layouts/posts.html CHANGED
@@ -1,13 +1,14 @@
1
1
  ---
2
- permalink: /posts.html
3
2
  layout: default
3
+ permalink: /posts/
4
4
  ---
5
5
 
6
6
  <div class="content">
7
7
  <div class="posts-all">
8
8
  <!-- prettier-ignore -->
9
- {% assign selection = site.posts | where_exp:"post", "post.list_post == true" %}
10
- {% for post in selection %}
9
+ {% assign selection = site.posts | where_exp:"post", "post.layout == 'post'" %}
10
+ {% assign selection = selection | where_exp:"post", "post.content.size > 1" %}
11
+ {% for post in selection %}
11
12
  {% include post-list-item.html %}
12
13
  {% assign nr_of_posts = nr_of_posts | plus:1 %}
13
14
  {% endfor %}
data/bin/install-theme ADDED
@@ -0,0 +1,66 @@
1
+ require 'fileutils'
2
+
3
+ # Create 'posts.md'
4
+ File.write('posts.md', <<~HEREDOC
5
+ ---
6
+ layout: posts
7
+ permalink: posts
8
+ ---
9
+ HEREDOC
10
+ )
11
+
12
+ if !Dir.exist?("docs")
13
+ Dir.mkdir("docs")
14
+ end
15
+
16
+ Dir.glob("*").each do |file|
17
+ next if file == ".gitignore" || file == "docs"
18
+ if File.directory?(file)
19
+ FileUtils.mkdir_p("docs/#{file}")
20
+ FileUtils.cp_r("#{file}/.", "docs/#{file}/")
21
+ FileUtils.rm_rf(file)
22
+ else
23
+ FileUtils.mv(file, "docs/#{file}")
24
+ end
25
+ end
26
+
27
+ # Create 'script/deploy'
28
+ if !Dir.exist?("script")
29
+ Dir.mkdir("script")
30
+ end
31
+
32
+ File.write('script/deploy', <<~HEREDOC
33
+ #!/bin/bash
34
+
35
+ MAIN_BRANCH="main"
36
+ DEPLOY_BRANCH="gh-pages"
37
+
38
+ # Clear files in deploy_branch
39
+ git checkout $DEPLOY_BRANCH
40
+ rm -r docs
41
+
42
+ # Get docs-files/folders from main_branch
43
+ git checkout $MAIN_BRANCH -- docs
44
+ cd docs || exit
45
+
46
+ # Build _site contents
47
+ bundle exec jekyll build
48
+ cd .. || exit
49
+
50
+ # Delete everything except for the docs/_site folder
51
+ find docs -mindepth 1 -maxdepth 1 ! -name '_site' -exec rm -r {} +
52
+
53
+ # Move all files in docs/_site to the docs folder
54
+ mv docs/_site/* docs
55
+
56
+ # Create commit with last message from main_branch and commit to deploy_branch
57
+ git add .
58
+ COMMIT_MESSAGE=$(git log $DEPLOY_BRANCH -1 --pretty="%h %s")
59
+ git commit -m "$COMMIT_MESSAGE"
60
+ git push origin $DEPLOY_BRANCH
61
+ git checkout $MAIN_BRANCH
62
+ HEREDOC
63
+ )
64
+
65
+
66
+ File.chmod(0777, "script/deploy")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-gh-pages-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - LiveNL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-01 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll-archives
@@ -55,12 +55,14 @@ dependencies:
55
55
  description:
56
56
  email:
57
57
  - simple-gh-pages-theme@jordiwippert.nl
58
- executables: []
58
+ executables:
59
+ - install-theme
59
60
  extensions: []
60
61
  extra_rdoc_files: []
61
62
  files:
62
63
  - LICENSE.txt
63
64
  - README.md
65
+ - _config.yml
64
66
  - _data/navigation.yml
65
67
  - _includes/highlights.html
66
68
  - _includes/intro.html
@@ -72,15 +74,19 @@ files:
72
74
  - _layouts/404.html
73
75
  - _layouts/category-posts.html
74
76
  - _layouts/default.html
77
+ - _layouts/home.html
75
78
  - _layouts/index.html
79
+ - _layouts/page.html
76
80
  - _layouts/post.html
77
81
  - _layouts/posts.html
78
82
  - _sass/main.scss
79
83
  - assets/css/main.scss
84
+ - bin/install-theme
80
85
  homepage: https://github.com/LiveNL/simple-gh-pages-theme
81
86
  licenses:
82
87
  - MIT
83
- metadata: {}
88
+ metadata:
89
+ github_repo: https://github.com/LiveNL/simple-gh-pages-theme
84
90
  post_install_message:
85
91
  rdoc_options: []
86
92
  require_paths: