Skip to content

Commit

Permalink
feat(config): add a namespace to the theme config map (#2)
Browse files Browse the repository at this point in the history
- update readme
- ensure normalize.css is included
- fix padding on index article element
  • Loading branch information
dbeg authored Jul 14, 2020
1 parent 1bbaa63 commit 8e48284
Show file tree
Hide file tree
Showing 11 changed files with 429 additions and 46 deletions.
60 changes: 43 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# jekyll-theme-guardian

Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.

To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!

TODO: Delete this and the text above, and describe your gem

![jekyll-theme-guardian preview](/screenshot.png)

## Installation

Add this line to your Jekyll site's `Gemfile`:

```ruby
gem "jekyll-theme-guardian"
gem "jekyll-theme-guardian", git: '[email protected]:widen/jekyll-theme-guardian.git', branch: "master"
```

And add this line to your Jekyll site's `_config.yml`:
Expand All @@ -23,30 +18,61 @@ theme: jekyll-theme-guardian
And then execute:
$ bundle
```bash
$ bundle
```

## Usage

Or install it yourself as:
### Configuration

$ gem install jekyll-theme-guardian
A number of configuration options are setup for use within your Jekyll site's `_config.yml`, all of the theme-specific options are prefixed with `guardian`:

## Usage
```yaml
guardian:
style:
logo_url: <URL>
header_background_url: <URL>
social_links:
twitter: <TWITTER_USERNAME>
github_org: <GITHUB_ORGANIZATION_NAME>
github_repo: <GITHUB_REPOSITORY_NAME>
tracking:
google_analytics_code: <GOOGLE_ANANLYTICS_CODE>
disqus_shortname: <DISQUS_SHORTNAME>
```
### Layouts
* `default` - includes a header, content, and footer section
* `post` - extends `default` and optionally includes a Disqus comment block

### includes

TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
* `head` - included on the `default` layout; specifies title, stylesheets, etc.
* `favicons` - sets up links to favicons for browsers and mobile devices
* `analytics` - if `site.guardian.tracking.google_analytics_code` is populated, this will include GA tracking code
* `header` - included on the `default` layout; renders the header with `site.guardian.style.logo_url` and `site.guardian.style.header_background_url`
* `footer` - included on the `default` layout; renders a footer with social links
* `git-info` - includes links to GitHub to view/edit content
* `disqus` - included on the `post` layout; if `site.guardian.tracking.disqus_shortname` is populated, this will include a Disqus comment block

### Assets

* `app.css` - the main stylesheet; includes imported content from `_sass` as well as `normalize.css`
* `fonts` - the Ionicon font-family is included and wired for use
* `images` - a number of Widen-branded favicons are included in various sizes

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/hello. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on GitHub at https://github.com/widen/jekyll-theme-guardian. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## Development

To set up your environment to develop this theme, run `bundle install`.

Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. 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.

When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
To add a custom directory to your theme-gem, please edit the regexp in `jekyll-theme-guardian.gemspec` accordingly.

## License

The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

18 changes: 11 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# theme configuration
logo_url: https://embed.widencdn.net/img/widen/c17yrvuaac/400px@2x/Widen Engineering White Logo.png?u=mcuc7i
header_background_url: https://embed.widencdn.net/img/widen/m4ml1kuspv/exact/1680x90_Engineering Blog Banner.png?keep=c&crop=yes&u=ksmgip
twitter_username: widendev
github_widen: https://github.com/widen
github_repository: https://github.com/widen/jekyll-theme-guardian
google_analytics_code:
disqus_shortname:
guardian:
style:
logo_url: https://embed.widencdn.net/img/widen/c17yrvuaac/400px@2x/Widen Engineering White Logo.png?u=mcuc7i
header_background_url: https://embed.widencdn.net/img/widen/m4ml1kuspv/exact/1680x90_Engineering Blog Banner.png?keep=c&crop=yes&u=ksmgip
social_links:
twitter: widendev
github_org: widen
github_repo: jekyll-theme-guardian
tracking:
google_analytics_code:
disqus_shortname:
4 changes: 2 additions & 2 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% if site.google_analytics_code %}
{% if site.guardian.tracking.google_analytics_code %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{site.google_analytics_code}}']);
_gaq.push(['_setAccount', '{{site.guardian.tracking.google_analytics_code}}']);
_gaq.push(['_trackPageview']);

(function() {
Expand Down
4 changes: 2 additions & 2 deletions _includes/disqus.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% if site.disqus_shortname %}
{% if site.guardian.tracking.disqus_shortname %}
<div class="comments">
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '{{ site.disqus_shortname }}';
var disqus_shortname = '{{ site.guardian.tracking.disqus_shortname }}';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
Expand Down
6 changes: 3 additions & 3 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
<nav>
<ul class="site-social-links inline">
<li><a target="_blank" title="RSS Feed" href="/feed.xml" class="ion-social-rss"></a></li>
<li><a target="_blank" title="GitHub" href="{{site.github_widen}}" class="ion-social-github"></a></li>
<li><a target="_blank" title="Twitter" href="https://twitter.com/{{site.twitter_username}}" class="ion-social-twitter"></a></li>
<li><a target="_blank" title="GitHub" href="https://github.com/{{ site.guardian.social_links.github_org }}" class="ion-social-github"></a></li>
<li><a target="_blank" title="Twitter" href="https://twitter.com/{{ site.guardian.social_links.twitter }}" class="ion-social-twitter"></a></li>
</ul>
</nav>
<p>© Copyright {{ site.time | date: '%Y' }}, <a title="Widen Homepage" target="_blank" href="http://widen.com">Widen Enterprises, Inc.</a></p>

<p><strong>Looking for work?</strong> <a title="Come engineer with us!" target="_blank" href="http://www.widen.com/careers/">Come engineer with us!</a></p>
<p><strong>Something wrong with this page?</strong> Please <a title="Create new issue on bugtracker" target="_blank" href="{{site.github_repository}}/issues/new">file a bug</a>.</p>
<p><strong>Something wrong with this page?</strong> Please <a title="Create new issue on bugtracker" target="_blank" href="https://github.com/{{ site.guardian.social_links.github_repo }}/issues/new">file a bug</a>.</p>
{% include git-info.html %}
</footer>
</div>
10 changes: 5 additions & 5 deletions _includes/git-info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<nav>
<ul class="inline">
<li>
<a target="_blank" title="View site source on GitHub" href="{{ site.github_repository }}">source</a>
<a target="_blank" title="View site source on GitHub" href="https://github.com/{{ site.guardian.social_links.github_repo }}">source</a>
</li>
<li>
<a target="_blank" title="View current page on GitHub" href="{{ site.github_repository }}/blob/master/{{page.path}}">view</a>
<a target="_blank" title="View current page on GitHub" href="https://github.com/{{ site.guardian.social_links.github_repo }}/blob/master/{{page.path}}">view</a>
</li>
<li>
<a target="_blank" title="Edit current page on GitHub" href="{{ site.github_repository }}/edit/master/{{page.path}}">edit</a>
<a target="_blank" title="Edit current page on GitHub" href="https://github.com/{{ site.guardian.social_links.github_repo }}/edit/master/{{page.path}}">edit</a>
</li>
<li>
<a ="_blank" title="Last site commit" href="{{ site.github_repository }}/commit/{{ site.git.last_commit.short_sha }}">{{ site.git.last_commit.short_sha }}</a>
<a target="_blank" title="Last site commit" href="https://github.com/{{ site.guardian.social_links.github_repo }}/commit/{{ site.git.last_commit.short_sha }}">{{ site.git.last_commit.short_sha }}</a>
</li>
<li>
<a target="_blank" title="Last page commit" href="{{ site.github_repository }}/commit/{{ page.git.last_commit.short_sha }}">{{ page.git.last_commit.short_sha }}</a>
<a target="_blank" title="Last page commit" href="https://github.com/{{ site.guardian.social_links.github_repo }}/commit/{{ page.git.last_commit.short_sha }}">{{ page.git.last_commit.short_sha }}</a>
</li>
</ul>
</nav >
Expand Down
2 changes: 1 addition & 1 deletion _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="wrapper">
<div class="logo">
<a href="/">
<img width="400" alt="{{ site.title }} Logo" src="{{ site.logo_url }}">
<img width="400" alt="{{ site.title }} Logo" src="{{ site.guardian.style.logo_url }}">
</a>
</div>
<br class="clear"/>
Expand Down
20 changes: 12 additions & 8 deletions _sass/_index.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
.posts {
article {
margin-bottom: 30px;
}
ul {
padding-left: 0;
}

.posts-excerpt {
font-style: italic;
font-size: 1.65rem;
color: $dark-grey;
}
article {
margin-bottom: 30px;
}

.posts-excerpt {
font-style: italic;
font-size: 1.65rem;
color: $dark-grey;
}
}
2 changes: 1 addition & 1 deletion assets/css/app.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
---
$header_background_url: "{{ site.header_background_url }}";
$header_background_url: "{{ site.guardian.style.header_background_url }}";

@charset "utf-8";

Expand Down
Loading

0 comments on commit 8e48284

Please sign in to comment.