Coder Social home page Coder Social logo

rohanchandra / type-theme Goto Github PK

View Code? Open in Web Editor NEW
702.0 9.0 556.0 342 KB

A free and open-source Jekyll theme with responsive design. Great for blogs and easy to customize.

Home Page: https://rohanchandra.github.io/type-theme/

License: MIT License

HTML 56.81% CSS 32.20% JavaScript 10.72% Ruby 0.26%
jekyll jekyll-theme jekyll-themes github-pages

type-theme's Introduction

Type Theme

Default Type Theme blog

A free and open-source Jekyll theme. Great for blogs and easy to customize.

Demo

Usage

  1. Fork and clone the Type Theme repo: git clone https://github.com/rohanchandra/type-theme
  2. Install Jekyll: gem install jekyll
  3. Install the theme's dependencies: bundle install
  4. Customize the theme (see below)
  5. Run the Jekyll server: jekyll serve

Customizing Type Theme

Open _config.yml in a text editor to change most of the blog's settings.

If a variable in this document is marked as "optional", disable the feature by removing all text from the variable. For example, to prevent the avatar from rendering in the header, the avatar line should read:

theme:
  title: Type Theme
  avatar:
  gravatar:

Notice the avatar variable is left intentionally blank.

Below is a summary of the configuration options in Type Theme.

Site configuration

The most common configurations, included here for guidance, are:

Jekyll website without a subpath (such as a GitHub Pages website for a given username):

# SITE CONFIGURATION
baseurl: ""
url: "https://username.github.io"

Jekyll website with subpath (like the Type Theme demo page):

# SITE CONFIGURATION
baseurl: "/sub-directory"
url: "https://username.github.io/"

Please configure this in _config.yml before using the theme.

Meta

Meta variables hold basic information about your Jekyll site which will be used throughout the site and as meta properties for search engines, browsers, and the site's RSS feed.

Change these variables in _config.yml:

Variable Example Description Optional
title My Jekyll Blog Name of website Yes
avatar assets/img/avatar.png Path of avatar image, to be displayed in the theme's header Yes
gravatar f9879d71855b5ff21e4963273a886bfc MD5 hash of your email address to load your Gravatar in the theme's header Yes
description My blog posts Short description, primarily used by search engines Yes

Header and footer text

Change these variables in _config.yml:

Variable Example Description Optional
header_text Welcome to my Jekyll blog HTML (shown below the navigation) with a background colour for emphasis Yes
header_text_feature_image assets/img/sample_feature_img_3.png Background image for the header text Yes
footer_text Copyright 2014 HTML (shown at end of the site) with lighter text Yes

Icons

Add your username on selected websites in the icon section of the _config.yml file to display the site's icon from Font Awesome in the header navigation. All icon variables should be your username enclosed in quotes (e.g. "username"), except for the following variables:

Variable Example Description Optional
rss true Takes boolean value (true/false) to show RSS feed icon Yes
email_address [email protected] Email address Yes
linkedin https://www.linkedin.com/in/FirstLast Full URL to profile on LinkedIn Yes
stack_exchange https://stackoverflow.com/users/0000/first-last Full URL to profile on Stack Exchange Yes

Scripts

Change these variables in _config.yml:

Variable Example Description Optional
google_analytics UA-123456-01 Google Analytics tracking ID Yes
disqus_shortname shortname Disqus shortname Yes
katex true Takes boolean value (true/false) to conditionally load KaTeX scripts required for math typesetting Yes

Scripts listed here are only loaded if you provide a value in the _config.yml file.

Localization strings

Change localization string variables in _config.yml.

English text used in the theme (such as the "continue reading" label) has been grouped so you can quickly translate the theme or change labels to suit your needs.

Colours, typography, padding

A selection of colours set in Type Theme by modifying the CSS

Variable Example Description Optional
google_fonts "Playfair+Display:400,700\ PT+Sans:400,700,700italic,400italic" Google Fonts to load for use

Navigate to the _sass > base directory and open _variables.scss to change colours, typography and padding used in the theme with CSS.

Once you have loaded a Google Font in config.yml, you can integrate the fonts into your CSS by changing the font-family in _variables.scss. For example, after loading the Playfair Display and PT Sans fonts from Google:

// Typography
$font-family-main: 'PT Sans', Helvetica, Arial, sans-serif;
$font-family-headings: 'Playfair Display', Helvetica, Arial, sans-serif;

Mozilla's ColorPicker is a helpful tool to get your preferred colours in hexadecimal or RGBA form for use in _variables.scss.

Customize style when using the remote_theme

If you're using Type Theme as a remote_theme, you can override variables and styles. To do so, simply create a assets/css/main.scss file on your website with the following content:

// assets/css/main.scss
---
---

@import "type-theme";

@import "type-theme"; includes the theme styles, so you can add custom imports before and after it, depending on your needs. Best practice is to put your custom files in the _sass folder of your project. Jekyll will automatically look for them there. For example, say you wanted to override some theme variables and add some custom styles, you can create the following files:

// _sass/_variables.scss
$background-color: black;
// _sass/_custom.sass

// SASS is supported as well, just note the file extension is .sass
.feature-image header
  height: 300px

Then import them both into main.scss:

// assets/css/main.scss
---
---

@import "variables";
@import "type-theme";
@import "custom";

Posts and pages in Type Theme

Please refer to the Jekyll docs for writing posts. Non-standard features are documented below.

Math typesetting

Wrap math expressions with $$ signs in your posts and make sure you have set the katex variable in _config.yml to true for math typesetting.

For inline math typesetting, type your math expression on the same line as your content. For example:

Type math within a sentence $$2x^2 + x + c$$ to display inline

For display math typesetting, type your math expression on a new line. For example:

$$
  \bar{y} = {1 \over n} \sum_{i = 1}^{n}y_i
$$

Type Theme makes use for KaTeX for typesetting.

Feature images

Posts with geometric feature images

Add a feature image by specifying a path to an image in the front matter in the form of feature-img: "img/PATH_TO_IMAGE.png".

For example:

---
layout: post
title: Hello World
feature-img: "assets/img/sample_feature_img.png"
---

By default, the page title is displayed on top of the feature image, as well as on the browser's tab. You can change the feature image's displayed title by specifying a feature-title in the front matter:

---
layout: post
title: Short title
feature-title: A much longer title
feature-img: "assets/img/sample_feature_img.png"
---

Hiding pages from navigation

In the front matter of a page, add hide: true to prevent the page from showing up in the header's navigation bar (visitors can still visit the URL through other means).

For example:

---
layout: page
title: "Error 404: Page not found"
permalink: /404.html
hide: true
---

Sorting pages in navigation

You can configure this theme to sort your pages in the header's navigation bar.

  • Set site_navigation_sort in theme settings to a property name e.g. 'order'
  • In the front matter of a non-hidden page, add order: n

For example:

---
layout: page
title: Team
permalink: /team/
order: 4
---

Tags

Post tags should be placed between [] in your post metadata. Separate each tag with a comma.

For example:

---
layout: post
title: Markdown and HTML
tags: [sample, markdown, html]
---

A tags listing will be automatically generated using the tags.html file provided in Type Theme. If you're not using the tags feature it is safe to delete tags.html.

Search

The search feature can be activated in the _config.yml file by changing its value from false to true.

  #Scripts
  search: true

Once activated, the search bar will appear in the header. This feature uses Lunr and searches through the title, tags and content of your posts.

Subtitles

A subtitle can be displayed below your title on permalink post pages.

To enable this feature, add subtitle to your post metadata.

For example:

---
layout: post
title: "This is a title"
subtitle: "This is a subtitle"
---

License

The MIT License (MIT)

type-theme's People

Contributors

achmiral avatar billytrend avatar busches avatar divayprakash avatar dustinvtran avatar gaberber avatar geonu avatar imactia avatar klieret avatar newvertex avatar punkeel avatar rishibaldawa avatar robertmarsal avatar rohanchandra avatar salmanulfarzy avatar saojeda avatar stilgarisca avatar sylhare avatar technoweenie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

type-theme's Issues

Reduce the dependencies to only use actual dependencies

Context: I started looking into reducing the dependencies that are installed because I was tired of waiting for lengthy builds to complete.

Currently, the Gemfile contains the following which will install ~85 gems which takes several seconds.

# Gemfile - as of 9/14/2019
source "https://rubygems.org"
gem 'github-pages', group: :jekyll_plugins

If instead, you specify the actually required gems, you can install ~5 gems which is tremendously faster and should provide the same results.

# Gemfile - a much more efficient method
source "https://rubygems.org"
group :jekyll_plugins do
  gem "jekyll-paginate"
  gem "rouge"
  gem "kramdown-parser-gfm"
end

This is what I am doing and it is working great. If you were to run into any dependency issues, you could simply add --trace to the build command and then add whatever was being complained about (assuming it is a gem) to the Gemfile.

For example, if the error was,

/usr/gem/gems/jekyll-4.0.0/lib/jekyll/converters/markdown/kramdown_parser.rb:53:in `require': cannot load such file -- kramdown-parser-gfm (LoadError)

Then you would simply add gem "kramdown-parser-gfm" to the Gemfile, as I have done.

By the way, I really like what you have done here.

Unable to contribute?

I tried pushing my commits but git wouldn't allow me. Can you please add me as a contributor.

Tag support

It would be great to have tags to post, and have them organized in another page.

Switching Google Fonts to the Mozilla Fira font

Hi,

I'm unclear on how to remove Google fonts in favor of using an open source font. For example, if I wanted to move to Firefox's Fira font without going through Google, how would I do that? I'm in China and the connection to Google is often blocked/extremely slow.

Thanks a lot!

Search is not working other than English

Current lunr.js/0.7.1/lunr.min.js is only working in English Search. I tried to use 2.3.6 version instead cos lots of languages are supported but the whole search started not working.

search.html

<script src="https://cdnjs.cloudflare.com/ajax/libs/lunr.js/0.7.1/lunr.min.js" charset="utf-8"></script>

Gem version / GitHub Pages remote_theme support

The Type Theme gem and GitHub Pages remote_theme support is in development.

To use the remote theme:

  1. Create a new Jekyll site
  2. Add a key-value pair of remote_theme: rohanchandra/type-theme to _config.yml
  3. Switch from index.md to index.html to enable pagination

Known issues with this development gem are:

  • SCSS variables are not editable (fixed by @iMacTia)
  • Tags listing (tags.html) not available (fixed by @sylhare)

Jekyll 3.x support

  • Switch to Rouge as highlighter
  • Add jekyll-paginate as dependency
  • Check relative permalinks have 3.x support
  • Test on Github Pages
  • Write new documentation for installing dependencies

Install on Windows

I'm running Jekyll on windows with Ruby and getting the following error:

[!] There was an error parsing Gemfile:
[!] There was an error while loading jekyll-theme-type.gemspec: No such file or directory - git ls-files -z. Bundler cannot continue.

from C:/Users/zheng/Documents/type-theme/jekyll-theme-type.gemspec:13

-------------------------------------------

spec.add_development_dependency "rake", "~> 10.0"

end

# coding: utf-8

-------------------------------------------

. Bundler cannot continue.

from C:/Users/zheng/Documents/type-theme/Gemfile:2

-------------------------------------------

source "https://rubygems.org"

gemspec

source "https://rubygems.org"

-------------------------------------------

gh-pages is out of sync with master

Allo,

It seems like gh-pages is out of sync with master, it might be a good idea to update it (+ we would see the new features online \o/).
That would maybe help clarify #71 to see if there really is a problem with the github hosting of the new version of the theme.

Ship theme as a gem

This is a nice theme!

Do you plan to provide ability for Jekyll's users to simply add theme: jekyll-type-theme and bundle install to use your theme?

Extending a compound selector is deprecated

FYI, I recently noticed this ominous warning:

DEPRECATION WARNING on line 74 of /srv/jekyll/_sass/layouts/_posts.scss:
Extending a compound selector, a.button:hover, is deprecated and will not 
be supported in a future release. 
See https://github.com/sass/sass/issues/1599 for details.

DEPRECATION WARNING for a.button:hover

I only started seeing this once I updated jekyll from 3.4.3 to 3.4.5, but when I run

bundle exec jekyll serve

on this repo I get the following warning:

DEPRECATION WARNING on line 89 of /Users/abisee/type-theme/_sass/layouts/_posts.scss:
Extending a compound selector, a.button:hover, is deprecated and will not be supported in a future release.
See https://github.com/sass/sass/issues/1599 for details.

kramdown and KaTeX conflict

The current implementation of KaTeX in the theme via /js/katex_init.js leaves a known conflict between kramdown and KaTeX unaddressed. Kramdown outputs a %CDATA markup for some math formulae in its conversion to html. The % there chokes KaTeX and all the math thereafter will not be rendered.

I didn't touch katex_init.js but found a rather easy workaround. Instead of using katex_init.js, a few lines in /_includes/footer.html found in this kramdown issue will do (this is also the method suggested on the official kramdown page for working with KaTeX):

{% if site.theme_settings.katex %}
<script src="{{ "/js/jquery-3.2.1.min.js" | prepend: site.baseurl }}"></script>
<script>
   $("script[type='math/tex']").replaceWith(function() {
       var tex = $(this).text();
       // replace() here is due to CDATA wrapper (#224). KaTeX chokes on the % character,
       // which is unfortunate (and should probably be reported).
       return katex.renderToString(tex.replace(/%.*/g, ''), {displayMode: false});
   });

   $("script[type='math/tex; mode=display']").replaceWith(function() {
       var tex = $(this).html();
       // replace() here is due to CDATA wrapper (#224). KaTeX chokes on the % character,
       // which is unfortunate (and should probably be reported).
       return katex.renderToString(tex.replace(/%.*/g, ''), {displayMode: true});
   });
</script>
{% endif %}

Two notes:

  • The original author assumed that the %CDATA markup only appears in math blocks and not inline math. This is not true. Both inline and block math codes needs stripping away the %CDATA, as I've slightly changed here.
  • The script requires jQuery. I've put a copy of jQuery in the /js folder.

I'm no web developer but if this makes sense I can make a pull request.

Double bottom rule when using comments

Hi Rohan,

again thanks for creating this wonderful theme. Just a small thing that I noticed: When using some comment plugin there will be two horizontal rules (small one and a big one) at the bottom which doesn't look too pretty IMO:

selection_002

I fixed that as follows:

diff --git a/_sass/layouts/_posts.scss b/_sass/layouts/_posts.scss
index c332118..2942f99 100644
--- a/_sass/layouts/_posts.scss
+++ b/_sass/layouts/_posts.scss
@@ -4,10 +4,14 @@
 article,
 .comments {
   @extend %padding-regular;
-  border-bottom: 1px solid $border-color;
   float: left;
   width: 100%;
 }
+
+article {
+  border-bottom: 1px solid $border-color;
+}
+
 article {
   .subtitle {
     font-size: 1.45em;
(END)

Cheers,
Kilian

Uncaught SyntaxError: Invalid shorthand property initializer

When I run

bundle exec jekyll serve

on this repo, I get a number of errors:

screenshot 2017-08-30 11 10 51

What's causing these errors and could they be causing other problems? I'm using the Type theme for my website and I'm having a number of problems that are hard to diagnose, and I'm not sure if this error is part of it.

A question about _config.yml site.url

Hi.

While I make sitemap.xml file to submit to a search console,
I wonder that why _config.yml site.url should have / at last.

Similar to the PR #99,
because site.url has / in last, there is two slashes // in sitemap.xml.

For instance, in the case of the last version of _config.yml 4380fa6,
my sitemap.xml generates a url like https://rohanchandra.github.io///2014/11/30/sample-post.html.

I changed the code like b89c2fa or

url: “https://rohanchandra.github.io”

I don’t open PR yet, because I don’t know whether this issue is intended or not, more even related or not.
Please let me know it is okay to change.

Responsiveness

First of all, thanks for this great theme, I love it! Given that this theme is quite popular I found strange that it does not look good on smaller devices. Has anyone implemented some changes to improve it? If that's not the case I am willing to contribute.

GitHub Pages: The page build completed successfully, but returns error

I used your theme on github, but github has been sending emails to me

"The page build completed successfully, but return The following warning for master branch: You are attempting to use a 'Jekyll - theme - type' Jekyll theme, which is not supported by making Pages."

But I saw your demo was hosted on github. Have you received any email like that?

Can you help me solve this problem?

Fresh fork does not work

I really like this theme and forked it with the goal to use it for my github page.

Right now it unfortunately seems that, out of the gate, it does render as intended.
I have little to no experience with html or CSS as of yet, so I am not sure if this is only due to a minor problem that can be fixed easily or whether this would require more work (Which yould probably mean that I will keep looking for another template to use).

Any comments or help are very welcome!

Type theme (without Github) not working properly (on Jekyll 3.1.1)

I have Jekyll 3.1.1 running and would like to use the Type theme standalone / without Github by copying the content of the _site directory to my web server).

Running jekyll -serve with Type theme is working properly / producing the desired output / design:

bildschirmfoto 2016-02-14 um 12 24 40

But the content in the _site directory is missing any of the Type theme's design:
bildschirmfoto 2016-02-14 um 12 24 53

What am I missing / doing wrong here?

Many thanks for your support!

Issue with nested bullet lists

Using this theme, the following markdown is not rendered correctly:

## Contents
* [Card Matching](#card-matching)
* [Game Play](#game-play)
    * [A Hint](#a-useful-hint)
* [Support](#support)

Result:

screen shot 2016-05-14 at 6 21 29 am

Subtitles

I think it would be useful to have optional subtitles for blog posts in type-theme. I'm not an experienced Ruby developer, so it may take me some time to get this working. Eventually I'll submit my implementation as a pull request. Comments and suggestions welcome.

Disabling katex results in a JavaScript error

If you set katex: false in the _config.yml you'll get a JavaScript error with main.js. I added the following to footer.html to just not include main.js, but wasn't sure if people were extending it as well or only using it to enable katex.

{% if site.theme.katex %}
<script src="{{ "/js/main.js" | prepend: site.baseurl }}"></script>
{% endif %}

If this is an acceptable solution you'd like to merge in, let me know and I can send a PR.

Type theme is not working

Type theme is working in jekyll serve, but not in blog url.
I also checked the url code in _config.yml , but there is nothing wrong

image

Do you know the solution?

A page should only contain one h1

Thank you for the theme!

I noticed that the site name and blog post titles oth use <h1> tags. For SEO reasons, a page should only ever contain one <h1>. There can be multiple <h2> tags present on a page, however, with no negative SEO implications.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.