Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ meta title: "My Title"
In your layout:

```erb
<%
metamagic site: "My Site", title: [:title, :site], separator: " — "
%>
<%= metamagic site: "My Site", title: [:title, :site], separator: " — " %>
```

This will render the following:
Expand All @@ -101,9 +99,7 @@ If you hadn't set the title in your view, it would just display the site name.
You can also use a proc to enable custom processing:

```erb
<%
metamagic site: "My Site", title: -> { title.include?(site) ? title : "#{title} — #{site}" }
%>
<%= metamagic site: "My Site", title: -> { title.include?(site) ? title : "#{title} — #{site}" } %>
```

This will insert the site name only if it is not already present in the title.
Expand All @@ -122,9 +118,7 @@ end
The proc is still needed in the layout to ensure the right context for the template:

```erb
<%
metamagic site: "My Site", title: -> { meta_title_for(title, site) }
%>
<%= metamagic site: "My Site", title: -> { meta_title_for(title, site) } %>
```

#### Keywords template
Expand All @@ -142,9 +136,7 @@ meta keywords: %{one two three}
In your layout:

```erb
<%
metamagic keywords: [:keywords, "four", "five", "six"]
%>
<%= metamagic keywords: [:keywords, "four", "five", "six"] %>
```

This will render the following:
Expand Down