Permalink
Browse files

DRY titles and descriptions, and better docs

closes #2

commit c4a400325e29d9857cb9f18417bdc0fd4078e8b0
Author: Daniel Palmer <danny@dannyprose.com>
Date:   Sun Sep 2 21:17:02 2012 -0700

    Some better docs

commit 519b2683b1cefed9c90a9ce61c8ef9109f6af491
Author: Daniel Palmer <danny@dannyprose.com>
Date:   Sun Sep 2 20:00:13 2012 -0700

    Small License change

commit 1bc682660fd9bcbc1e36cc9555c1360570db954d
Author: Daniel Palmer <danny@dannyprose.com>
Date:   Sun Sep 2 19:32:28 2012 -0700

    Added global and individual page titles and descriptions
  • Loading branch information...
1 parent 5eb3a83 commit 44657484fca227634054f9c6ac6e43cd2b51ab77 @dannyprose committed Sep 3, 2012
View
@@ -1,5 +1,10 @@
# Changelog
+## 3.0.5 (September 2, 2012)
+
+* Smart site and page titles/descriptions through /helpers/site_helpers.rb
+* Better documentation
+
## 3.0.4 (September 2, 2012)
* [SMACSS](http://smacss.com/) stylesheet organization
@@ -16,4 +21,4 @@
## 3.0.1 and below
-See commit log
+See commit log
View
41 DOCS.md
@@ -0,0 +1,41 @@
+# Middleman / HTML5 Boilerplate Notes
+
+Please note that this port of the HTML5 Boilerplate has been converted to use HAML and Sprockets, while using a Middleman 3.x workflow.
+
+[The original HTML5 Boilerplate documentation](https://github.com/dannyprose/Middleman-HTML5BP-HAML/tree/master/html5bp-docs) is included at /html5bp-docs/ for your reference, but certain things (e.g. ways of including, specific javascript and CSS paths) may be different in our implementation.
+
+## Recommendations
+
+* Update `.rvmrc` to the [gemset](https://rvm.io/gemsets/basics/) of your choosing (or remove it if you do not use [RVM](https://rvm.io/))
+* Double check `.gitignore` and make sure it is what you want.
+ * eg: `build/` is ignored by default.
+* If you don't use `middleman init` to load the template, make sure to [use and run Bundler](http://gembundler.com/).
+
+## Site and Individual Page Titles and Descriptions
+
+One change we have made from the Boilerplate is some smarter ways of handling site/page titles and descriptions.
+
+Titles and descriptions are handled 2 ways:
+
+For the site at large, the title & description is handled through `/helpers/site_helpers.rb`. You can set them there, and the default layout file will include them on every page.
+
+For individual pages, just add some YAML data to the top of any given page (see our default index for an example):
+
+```
+ ---
+ title:
+ description:
+ ---
+```
+
+### Changing the Site Title and Description
+
+To the change site's title and description, edit the values in `/helpers/site_helpers.rb`. You can also edit the formatting for individual page title and descriptions here.
+
+To change, individual page's titles and descriptions, see the YAML method above.
+
+### But I Don't Want This
+
+No problem - we only included it because we just thought this was a good, DRY use case for Middelman, and it is what the Middleman Docs site uses.
+
+If you want to develop a method of your own, just remove the `page_title` and `page_description` methods in `/helpers/site_helpers.rb`, remove their references in `/layouts/layout.haml` (all within `<head>`), and restart Middleman. Then do whatever you want to include titles and headers.
View
@@ -1,4 +1,4 @@
-Copyright (c) HTML5 Boilerplate
+Copyright (c) Danny Palmer
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
View
@@ -0,0 +1,20 @@
+module SiteHelpers
+
+ def page_title
+ title = "Set your site title in /helpers/site_helpers.rb"
+ if data.page.title
+ title << " | " + data.page.title
+ end
+ title
+ end
+
+ def page_description
+ if data.page.description
+ description = data.page.description
+ else
+ description = "Set your site description in /helpers/site_helpers.rb"
+ end
+ description
+ end
+
+end
View
@@ -1,5 +0,0 @@
-# Middleman / HTML5 Boilerplate Note
-
-Please note that this port of Middleman 4.0 has been converted to use HAML and Sprockets, while using a Middleman 3.x workflow.
-
-The original HTML5 Boilerplate documentation is included here for your reference, but certain things (e.g. ways of including, specific javascript and CSS paths) may be different in our implementation.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -8,8 +8,9 @@ Features:
* Uses the [HTML5 Boilerplate 4.0](http://www.html5boilerplate.com), converted to a Middleman/HAML workflow.
* [Susy 1.0](http://susy.oddbird.net/) responsive grids ready to go.
-* [SMACSS](http://smacss.com/) stylesheet organization
+* [SMACSS](http://smacss.com/) stylesheet organization)
* [Middleman Livereload](https://github.com/middleman/middleman-livereload): enabled for the generic 'middleman' command by default
+* Smart Site/Page handling for titles and descriptions (via the Middleman Docs source
* [Middleman Favicon Maker](https://github.com/follmann/middleman-favicon-maker): creates favicons and touch icons on build from `favicon_base.png` in /source/
* RVM-ready
* Some good `.gitignore` defaults
@@ -22,7 +23,7 @@ Download and install into ~/.middleman (you'll have to create this directory if
### Example
-1. Download/clone to: `~/.middleman/html4bphaml/`
+1. [Download](https://github.com/dannyprose/Middleman-HTML5BP-HAML/zipball/master)/clone to: `~/.middleman/html4bphaml/`
2. Then create your new Middleman project: `middleman init my_new_project --template=html4bphaml`
For more help follow [Middleman's project template instructions](http://middlemanapp.com/getting-started/welcome/).
@@ -31,12 +32,11 @@ For more help follow [Middleman's project template instructions](http://middlema
This will soon be bundled with Middleman by default. Stay tuned.
-## Recommendations
+## Documentation
-* Update `.rvmrc` to the [gemset](https://rvm.io/gemsets/basics/) of your choosing (or remove it if you do not use [RVM](https://rvm.io/))
-* Double check `.gitignore` and make sure it is what you want.
- * eg: `build/` is ignored by default.
-* If you don't use `middleman init` to load the template, make sure to [use and run Bundler](http://gembundler.com/).
+[Middleman HTML5 Boilerplate HAML documentation](https://github.com/dannyprose/Middleman-HTML5BP-HAML/tree/master/DOCS.md): A good overview of some of the small changes we made with this version of the HTML5 Boilerplate.
+
+[HTML5 Boilerplate documentation](https://github.com/dannyprose/Middleman-HTML5BP-HAML/tree/master/html5bp-docs): Documentation that is included with the HTML5 Boilerplate. ***Note that some things (e.g. paths) will differ between this version of the HTML5 Boilerplate and the original.***
## Older Middleman Versions
View
@@ -1,6 +1,6 @@
---
-title: Welcome to Middleman + HTML5 Boilerplate 3.0 Using HAML
-description: Description!
+title:
+description:
---
%p
@@ -9,11 +9,9 @@
%meta{:charset => "utf-8"}
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
- -#Set data.page.title for each page
- %title= data.page.title || "SET YOUR SITE NAME"
-
- -#Set data.page.description for each page
- %meta{:content => data.page.description || "SET YOUR SITE DESCRIPTION", :name => "description"}
+ -# To set titles and descriptions globally and for each individual page, see /DOCS.md
+ %title= page_title
+ %meta{:content => page_description, :name => "description"}
%meta{:content => "width=device-width", :name => "viewport"}

0 comments on commit 4465748

Please sign in to comment.