diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..65f7532 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.gem +.bundle +.jekyll-cache +.sass-cache +Gemfile.lock +_site diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..944d812 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +jekyll-theme-semantic2 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..6b4950e --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d9216dc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +language: ruby +rvm: + - 2.4 +script: + - jekyll build --drafts +deploy: + - provider: pages + skip-cleanup: true + github-token: $GITHUB_TOKEN + on: + branch: master + local-dir: _site + - provider: rubygems + api_key: $API_KEY + skip-cleanup: true + on: + tags: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..51a25f9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,5 @@ +Contributing Guidelines +======================= + +The preferred coding style for this project is the [Google HTML/CSS Style +Guide.](https://google.github.io/styleguide/htmlcssguide.html) diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..851fabc --- /dev/null +++ b/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gemspec diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f86ce27 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2018 Ramon de C Valle + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..356c51e --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +jekyll-theme-semantic2 +====================== + +[![Build Status](https://travis-ci.org/rcvalle/jekyll-theme-semantic2.svg?branch=master)](https://travis-ci.org/rcvalle/jekyll-theme-semantic2) + +A [Semantic UI -based](https://semantic-ui.com/) Jekyll theme. + + +Installation +------------ + +To install jekyll-theme-semantic2: + +1. Add the following lines to your Jekyll site's `Gemfile` file: + + gem 'jekyll-paginate' + gem 'jekyll-theme-semantic2' + +2. On a command prompt or terminal with your Jekyll site's directory as the + current working directory, run the following command: + + $ bundle install + + +Usage +----- + +To use jekyll-theme-semantic2: + +1. Add the `jekyll-paginate` plugin to your Jekyll site's `_config.yml` file + under `plugins`: + + plugins: + - jekyll-paginate + +2. Add the `paginate` option to your Jekyll site's `_config.yml` file and + replace `3` by the preferred maximum number of posts to display per page: + + paginate: 3 + +3. Add the following line to your Jekyll site's `_config.yml` file: + + theme: jekyll-theme-semantic2 + +4. Copy the `_plugins` directory from the theme's directory to your Jekyll + site's directory. + +5. Copy the `category.html` and `tag.html` files from the theme's `_layouts` + directory to your Jekyll site's `_layouts` directory. + +6. Copy the `index.html` file from the theme's directory to your Jekyll + site's directory. + +7. Optional: Add the following line to your Jekyll site's `_config.yml` file + and replace `UA-XXXXX-Y` by your Analytics tracking ID: + + analytics: UA-XXXXX-Y + +8. Optional: Add the following line to your Jekyll site's `_config.yml` file + and replace `EXAMPLE` by your Disqus shortname: + + disqus_shortname: EXAMPLE + +See [_config.yml](_config.yml) for an example configuration file. + + +Contributing +------------ + +See [CONTRIBUTING.md](CONTRIBUTING.md). + + +License +------- + +Licensed under the MIT license. See [LICENSE](LICENSE) for license text and +copyright information. diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..0e99d11 --- /dev/null +++ b/_config.yml @@ -0,0 +1,14 @@ +baseurl: /jekyll-theme-semantic2 +exclude: + - "*.gemspec" + - "CONTRIBUTING*" + - "Gemfile*" + - "LICENSE*" + - "README*" +paginate: 3 +paginate_path: /pages/:num/ +permalink: /:year/:month/:day/:title/ +plugins: + - jekyll-paginate +title: Title +url: https://rcvalle.github.io diff --git a/_drafts/lorem-ipsum.md b/_drafts/lorem-ipsum.md new file mode 100644 index 0000000..2f3983e --- /dev/null +++ b/_drafts/lorem-ipsum.md @@ -0,0 +1,19 @@ +--- +author: Unknown +categories: +- Uncategorized +comments: true +layout: post +published: true +tags: +- lorem ipsum +- lorem +- ipsum +title: Lorem ipsum +--- + +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam eaque ipsa, quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt, explicabo. Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos, qui ratione voluptatem sequi nesciunt, neque porro quisquam est, qui dolorem ipsum, quia dolor sit amet consectetur adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit, qui in ea voluptate velit esse, quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur? + +At vero eos et accusamus et iusto odio dignissimos ducimus, qui blanditiis praesentium voluptatum deleniti atque corrupti, quos dolores et quas molestias excepturi sint, obcaecati cupiditate non provident, similique sunt in culpa, qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio, cumque nihil impedit, quo minus id, quod maxime placeat, facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet, ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. diff --git a/_includes/analytics.html b/_includes/analytics.html new file mode 100644 index 0000000..ef4a463 --- /dev/null +++ b/_includes/analytics.html @@ -0,0 +1,11 @@ +{% if site.analytics %} + +{% endif %} diff --git a/_includes/categories.html b/_includes/categories.html new file mode 100644 index 0000000..b084682 --- /dev/null +++ b/_includes/categories.html @@ -0,0 +1,17 @@ +{% if include.post.categories %} + + {% if include.post.categories.size == 1 %} + {{ include.post.categories.first | capitalize }}. + {% else %} + {% assign penultimate = include.post.categories.size | minus: 2 %} + {% for i in (0..penultimate) %} + {% if include.post.categories.size == 2 %} + {{ include.post.categories[i] | capitalize }} + {% else %} + {{ include.post.categories[i] | capitalize }}, + {% endif %} + {% endfor %} + and {{ include.post.categories.last | capitalize }}. + {% endif %} + +{% endif %} diff --git a/_includes/categories_list.html b/_includes/categories_list.html new file mode 100644 index 0000000..fe99852 --- /dev/null +++ b/_includes/categories_list.html @@ -0,0 +1,9 @@ + diff --git a/_includes/disqus.html b/_includes/disqus.html new file mode 100644 index 0000000..edc4cb0 --- /dev/null +++ b/_includes/disqus.html @@ -0,0 +1,18 @@ +{% if site.disqus_shortname %} +
+ + +{% endif %} diff --git a/_includes/disqus_count.html b/_includes/disqus_count.html new file mode 100644 index 0000000..b621bd9 --- /dev/null +++ b/_includes/disqus_count.html @@ -0,0 +1,3 @@ +{% if site.disqus_shortname %} + +{% endif %} diff --git a/_includes/navigation.html b/_includes/navigation.html new file mode 100644 index 0000000..d46aeaf --- /dev/null +++ b/_includes/navigation.html @@ -0,0 +1,45 @@ +
+
+ +
+
+
+
+ + +
+
diff --git a/_includes/pages_list.html b/_includes/pages_list.html new file mode 100644 index 0000000..02a4437 --- /dev/null +++ b/_includes/pages_list.html @@ -0,0 +1,17 @@ + diff --git a/_includes/pagination.html b/_includes/pagination.html new file mode 100644 index 0000000..a6debbc --- /dev/null +++ b/_includes/pagination.html @@ -0,0 +1,25 @@ +{% if paginator.total_pages > 1 %} + +{% endif %} diff --git a/_includes/post.html b/_includes/post.html new file mode 100644 index 0000000..c6a0275 --- /dev/null +++ b/_includes/post.html @@ -0,0 +1,8 @@ +
+

{{ include.post.title }}

+

{% if include.post.author %}By on {% endif %}{% if include.post.comments %}. {% endif %}

+
+ {{ include.post.content | markdownify }} +
+

{% include post_tags.html post=include.post %}

+
diff --git a/_includes/post_categories.html b/_includes/post_categories.html new file mode 100644 index 0000000..441d476 --- /dev/null +++ b/_includes/post_categories.html @@ -0,0 +1,7 @@ +{% if include.post.categories %} + + {% for category in include.post.categories %} + {{ category | capitalize }} + {% endfor %} + +{% endif %} diff --git a/_includes/post_tags.html b/_includes/post_tags.html new file mode 100644 index 0000000..42a257a --- /dev/null +++ b/_includes/post_tags.html @@ -0,0 +1,7 @@ +{% if include.post.tags %} + + {% for tag in include.post.tags %} + #{{ tag }} + {% endfor %} + +{% endif %} diff --git a/_includes/posts_list.html b/_includes/posts_list.html new file mode 100644 index 0000000..571f33f --- /dev/null +++ b/_includes/posts_list.html @@ -0,0 +1,9 @@ + diff --git a/_includes/side_content.html b/_includes/side_content.html new file mode 100644 index 0000000..d0b0206 --- /dev/null +++ b/_includes/side_content.html @@ -0,0 +1,18 @@ + diff --git a/_includes/tags.html b/_includes/tags.html new file mode 100644 index 0000000..01f029d --- /dev/null +++ b/_includes/tags.html @@ -0,0 +1,17 @@ +{% if include.post.tags %} + + {% if include.post.tags.size == 1 %} + {{ include.post.tags.first }}. + {% else %} + {% assign penultimate = include.post.tags.size | minus: 2 %} + {% for i in (0..penultimate) %} + {% if include.post.tags.size == 2 %} + {{ include.post.tags[i] }} + {% else %} + {{ include.post.tags[i] }}, + {% endif %} + {% endfor %} + and {{ include.post.tags.last }}. + {% endif %} + +{% endif %} diff --git a/_includes/tags_list.html b/_includes/tags_list.html new file mode 100644 index 0000000..90ee642 --- /dev/null +++ b/_includes/tags_list.html @@ -0,0 +1,9 @@ + diff --git a/_layouts/blog.html b/_layouts/blog.html new file mode 100644 index 0000000..3d9de85 --- /dev/null +++ b/_layouts/blog.html @@ -0,0 +1,29 @@ +--- +layout: default +type: blog +--- + +
+
+
+
+ {% for post in paginator.posts %} +
+ {% include post.html post=post %} +
+ {% endfor %} +
+
+
+
+{% if paginator.total_pages > 1 %} +
+
+
+
+ {% include pagination.html %} +
+
+
+
+{% endif %} diff --git a/_layouts/category.html b/_layouts/category.html new file mode 100644 index 0000000..40282e5 --- /dev/null +++ b/_layouts/category.html @@ -0,0 +1,18 @@ +--- +layout: default +type: category +--- + +
+
+
+
+ {% for post in site.categories[page.category] %} +
+ {% include post.html post=post %} +
+ {% endfor %} +
+
+
+
diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..4c45d9d --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,54 @@ + + + + + + + {{ page.title | liquify }} + + + + + + +
+
+ {% include navigation.html %} + {{ content }} +
+
+ + + + {% include analytics.html %} + {% include disqus_count.html %} + + diff --git a/_layouts/page.html b/_layouts/page.html new file mode 100644 index 0000000..8ef74f4 --- /dev/null +++ b/_layouts/page.html @@ -0,0 +1,12 @@ +--- +layout: default +type: page +--- + +
+
+
+ {{ content }} +
+
+
diff --git a/_layouts/post.html b/_layouts/post.html new file mode 100644 index 0000000..77bfc68 --- /dev/null +++ b/_layouts/post.html @@ -0,0 +1,27 @@ +--- +layout: default +type: post +--- + +
+
+
+
+
+ {% include post.html post=page %} +
+
+
+
+
+{% if page.comments %} +
+
+
+
+ {% include disqus.html %} +
+
+
+
+{% endif %} diff --git a/_layouts/tag.html b/_layouts/tag.html new file mode 100644 index 0000000..659389e --- /dev/null +++ b/_layouts/tag.html @@ -0,0 +1,18 @@ +--- +layout: default +type: tag +--- + +
+
+
+
+ {% for post in site.tags[page.tag] %} +
+ {% include post.html post=post %} +
+ {% endfor %} +
+
+
+
diff --git a/_plugins/category_filter.rb b/_plugins/category_filter.rb new file mode 100644 index 0000000..6a7ad13 --- /dev/null +++ b/_plugins/category_filter.rb @@ -0,0 +1,10 @@ +module Jekyll + module CategoryFilter + def category_url(category) + site = @context.registers[:site] + site.config['categories_dir'] ? "#{site.config['baseurl']}/#{site.config['categories_dir']}/#{category.tr(' ', '-')}/" : "#{site.config['baseurl']}/categories/#{category.tr(' ', '-')}/" + end + end +end + +Liquid::Template.register_filter(Jekyll::CategoryFilter) diff --git a/_plugins/category_generator.rb b/_plugins/category_generator.rb new file mode 100644 index 0000000..7f0adc3 --- /dev/null +++ b/_plugins/category_generator.rb @@ -0,0 +1,26 @@ +module Jekyll + class CategoryPage < Page + def initialize(site, base, dir, category) + @site = site + @base = base + @dir = dir + @name = 'index.html' + + self.process(@name) + self.read_yaml(File.join(base, '_layouts'), 'category.html') + self.data['category'] = category + self.data['title'] = "Posts in “#{category.capitalize}”" + end + end + + class CategoryPageGenerator < Generator + safe true + + def generate(site) + if site.layouts.key?('category') + dir = site.config['categories_dir'] || 'categories' + site.categories.keys.each { |category| site.pages << CategoryPage.new(site, site.source, File.join(dir, category.tr(' ', '-')), category) } + end + end + end +end diff --git a/_plugins/liquify_filter.rb b/_plugins/liquify_filter.rb new file mode 100644 index 0000000..daee472 --- /dev/null +++ b/_plugins/liquify_filter.rb @@ -0,0 +1,9 @@ +module Jekyll + module LiquifyFilter + def liquify(input) + Liquid::Template.parse(input).render(@context) + end + end +end + +Liquid::Template.register_filter(Jekyll::LiquifyFilter) diff --git a/_plugins/tag_filter.rb b/_plugins/tag_filter.rb new file mode 100644 index 0000000..e138763 --- /dev/null +++ b/_plugins/tag_filter.rb @@ -0,0 +1,10 @@ +module Jekyll + module TagFilter + def tag_url(tag) + site = @context.registers[:site] + site.config['tags_dir'] ? "#{site.config['baseurl']}/#{site.config['tags_dir']}/#{tag.tr(' ', '-')}/" : "#{site.config['baseurl']}/tags/#{tag.tr(' ', '-')}/" + end + end +end + +Liquid::Template.register_filter(Jekyll::TagFilter) diff --git a/_plugins/tag_generator.rb b/_plugins/tag_generator.rb new file mode 100644 index 0000000..59783db --- /dev/null +++ b/_plugins/tag_generator.rb @@ -0,0 +1,26 @@ +module Jekyll + class TagPage < Page + def initialize(site, base, dir, tag) + @site = site + @base = base + @dir = dir + @name = 'index.html' + + self.process(@name) + self.read_yaml(File.join(base, '_layouts'), 'tag.html') + self.data['tag'] = tag + self.data['title'] = "Posts tagged with “#{tag}”" + end + end + + class TagPageGenerator < Generator + safe true + + def generate(site) + if site.layouts.key?('tag') + dir = site.config['tags_dir'] || 'tags' + site.tags.keys.each { |tag| site.pages << TagPage.new(site, site.source, File.join(dir, tag.tr(' ', '-')), tag) } + end + end + end +end diff --git a/atom.xml b/atom.xml new file mode 100644 index 0000000..21287be --- /dev/null +++ b/atom.xml @@ -0,0 +1,30 @@ +--- +--- + + + {{ "/" | absolute_url }} + + + {{ site.copyright }} + {{ site.description }} + {{ site.name }} + {{ site.posts.first.date | date_to_xmlschema }} + {% for post in site.posts %} + + + {{ post.author }} + + {% for category in post.categories %} + + {% endfor %} + + {{ post.content | xml_escape }} + + {{ post.url | absolute_url }} + + {{ post.date | date_to_xmlschema }} + {{ post.title }} + {{ post.date | date_to_xmlschema }} + + {% endfor %} + diff --git a/index.html b/index.html new file mode 100644 index 0000000..09e0ee5 --- /dev/null +++ b/index.html @@ -0,0 +1,5 @@ +--- +layout: blog +title: "{{ site.title }}" +type: home +--- diff --git a/jekyll-theme-semantic2.gemspec b/jekyll-theme-semantic2.gemspec new file mode 100644 index 0000000..b3711d5 --- /dev/null +++ b/jekyll-theme-semantic2.gemspec @@ -0,0 +1,18 @@ +Gem::Specification.new do |spec| + spec.files = Dir[*%w(_config.yml _includes/**/* _layouts/**/* _plugins/**/* *.html *.xml CONTRIBUTING* LICENSE* README*)] + spec.name = 'jekyll-theme-semantic2' + spec.summary = 'A Semantic UI -based Jekyll theme.' + spec.version = '0.0.1' + + spec.author = 'Ramon de C Valle' + spec.description = '' + spec.email = 'rcvalle@users.noreply.github.com' + spec.homepage = 'https://github.com/rcvalle/jekyll-theme-semantic2' + spec.license = 'MIT' + spec.metadata = {} + + spec.add_development_dependency "bundler", "~> 1.16" + spec.add_development_dependency "rake", "~> 12.3" + spec.add_runtime_dependency "jekyll", "~> 3.8" + spec.add_runtime_dependency "jekyll-paginate", "~> 1.1" +end diff --git a/rss.xml b/rss.xml new file mode 100644 index 0000000..6c41dc2 --- /dev/null +++ b/rss.xml @@ -0,0 +1,30 @@ +--- +--- + + + + {{ site.name }} + {{ "/" | absolute_url }} + {{ site.description }} + {{ site.copyright }} + {{ site.posts.first.date | date_to_rfc822 }} + {{ site.posts.first.date | date_to_rfc822 }} + + {% for post in site.posts %} + + {{ post.title }} + {{ post.url | absolute_url }} + + {{ post.content | xml_escape }} + + {% for category in post.categories %} + {{ category | capitalize }} + {% endfor %} + {{ post.url | absolute_url }}#disqus_thread + {{ post.url | absolute_url }} + {{ post.date | date_to_rfc822 }} + {{ site.name }} + + {% endfor %} + +