Skip to content

Commit 0e7cc13

Browse files
authored
Merge pull request #5 from MITLibraries/dynamic_metaheaders
Adds support for additional HTML meta tags
2 parents b0d2c2d + ef0d397 commit 0e7cc13

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ called multiple times the results are concatenated. This is intended primarily
5757
for adding external support libraries. For JS you are writing, include via
5858
`application.scss` as normal.
5959

60+
## Adding Additional Meta headers to HTML Head
61+
62+
You can load additional meta headers to individual pages using:
63+
64+
```
65+
<% content_for :additional_meta_tag do %>
66+
<meta name="description" content="Words and stuff about stuff or something.">
67+
<meta name="keywords" content="words,stuff,yoyos">
68+
<% end %>
69+
```
70+
71+
This can appear as many times as you need on as many templates as you need. If
72+
called multiple times the results are concatenated.
73+
6074
## Development
6175

6276
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

app/views/layouts/_head.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<title><%= content_for?(:title) ? yield(:title) : " MIT Libraries" %></title>
55
<%= csrf_meta_tags %>
66

7+
<%= yield :additional_meta_tag %>
8+
79
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
810
<!--[if lt IE 9]>
911
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js" type="text/javascript"></script>

lib/mitlibraries/theme/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Mitlibraries
22
module Theme
3-
VERSION = '0.1.0'.freeze
3+
VERSION = '0.2.0'.freeze
44
end
55
end

0 commit comments

Comments
 (0)