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

Event meta informations #14

Merged
merged 14 commits into from Aug 18, 2013
Next

added location meta information and special tag

  • Loading branch information...
nougad committed Aug 16, 2013
commit 397ac6957e1c7398fc132d1335879e522568e9f8
View
@@ -4,3 +4,17 @@ permalink: /:title
rdiscount:
extensions: [smart]
baseurl: http://vimberlin.de
locations:
launchco:
street: Warschauer Str. 70A
city: Berlin
postalcode: 10243
country: Germany
url: https://launchco.com/etc/#coworking
map: http://g.co/maps/k62eb
name: LAUNCH/CO
addition: 3rd floor
View
@@ -0,0 +1,34 @@
module Jekyll
class RenderLocation < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@addition_overwrite = text
end
def render(context)
# is there no pretty way to access the page?
page = context.environments.first["page"]
# is there no pretty way to access the config?
loc = context.registers[:site].config['locations'][page['where']]
addition = if @addition_overwrite != "" then @addition_overwrite else loc["addition"] end
<<DOC
<div itemprop="location" itemscope itemtype="http://schema.org/PostalAddress">
<a itemprop="url" href="#{loc["url"]}">
<div itemprop="name">#{loc["name"]}</div>
</a> #{addition}
<div itemprop="streetAddress">#{loc["street"]}</div>
<div>
<span itemprop="postalCode">#{loc["postalcode"]}</span>
<span itemprop="addressLocality">#{loc["city"]}</span>
</div>
<meta itemprop="addressCountry" content=#{loc["country"]} />
(<a href="#{loc["map"]}">map</a>)
</div>
DOC
end
end
end
Liquid::Template.register_tag('location', Jekyll::RenderLocation)
ProTip! Use n and p to navigate between commits in a pull request.