jekyll-maps 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/History.md +4 -0
- data/README.md +72 -1
- data/lib/jekyll-maps/google_map_api.rb +3 -1
- data/lib/jekyll-maps/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c779e67a99b76a3655d973fd5671d068d0709d7a
|
4
|
+
data.tar.gz: f5a9d0b3a557ec8c00cd7193b592b9c4f384fbfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd731507ed453f4f7d097f615a1373b8d3ed37fa6e2e9207e2bf996d27fce64d2790f633fb6c55f0bc2856fe5c8d995bc8f6643c202c9341522ad06a637c861e
|
7
|
+
data.tar.gz: 0b4c9c70d6894ea3354da45fa0f02050e8abde7d4dad9c9e618f20b8aa9daa9ca5c79a9670b8e7e143d358265e822080b517aa73ffdf10fe4c0658489033705c
|
data/.gitignore
CHANGED
data/History.md
CHANGED
data/README.md
CHANGED
@@ -6,4 +6,75 @@
|
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/ayastreb/jekyll-maps/badges/coverage.svg)](https://codeclimate.com/github/ayastreb/jekyll-maps/coverage)
|
7
7
|
[![Dependency Status](https://gemnasium.com/badges/github.com/ayastreb/jekyll-maps.svg)](https://gemnasium.com/github.com/ayastreb/jekyll-maps)
|
8
8
|
|
9
|
-
Google Maps
|
9
|
+
Easily embed Google Maps with locations from your Jekyll posts, pages or data files.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
1. Add the following to your site's `Gemfile`:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'jekyll-maps'
|
17
|
+
```
|
18
|
+
|
19
|
+
2. Add the following to your site's `_config.yml`:
|
20
|
+
|
21
|
+
```yml
|
22
|
+
gems:
|
23
|
+
- jekyll-maps
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
First, add location information to your posts YAML front-matter:
|
29
|
+
|
30
|
+
```yml
|
31
|
+
location:
|
32
|
+
latitude: 51.5285582
|
33
|
+
longitude: -0.2416807
|
34
|
+
```
|
35
|
+
|
36
|
+
Alternatively, you can add location info to your custom collection's documents or even in data files:
|
37
|
+
|
38
|
+
```yml
|
39
|
+
- title: Paris
|
40
|
+
url: http://google.fr
|
41
|
+
location:
|
42
|
+
latitude: 48.8587741
|
43
|
+
longitude: 2.2074741
|
44
|
+
|
45
|
+
- title: Madrid
|
46
|
+
url: http://google.es
|
47
|
+
location:
|
48
|
+
latitude: 40.4378698
|
49
|
+
longitude: -3.8196204
|
50
|
+
```
|
51
|
+
|
52
|
+
When you have your data ready, just add following tag to the page where you want to see the map:
|
53
|
+
|
54
|
+
```
|
55
|
+
{% google_map %}
|
56
|
+
```
|
57
|
+
|
58
|
+
You can configure map's dimensions and assign custom CSS class to the element:
|
59
|
+
|
60
|
+
```
|
61
|
+
{% google_map width:100% height:400 class:my-map %}
|
62
|
+
```
|
63
|
+
|
64
|
+
You can also filter which locations to display on the map!
|
65
|
+
|
66
|
+
For instance, following tag will only display points from documents which have `lang: en` in their front-matter data.
|
67
|
+
|
68
|
+
```
|
69
|
+
{% google_map lang:en %}
|
70
|
+
```
|
71
|
+
|
72
|
+
If you have any questions or proposals - open up an [issue](https://github.com/ayastreb/jekyll-maps/issues/new)!
|
73
|
+
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
1. Fork it (https://github.com/ayastreb/jekyll-maps/fork)
|
77
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
78
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
79
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
80
|
+
5. Create a new Pull Request
|
@@ -5,6 +5,7 @@ module Jekyll
|
|
5
5
|
|
6
6
|
class << self
|
7
7
|
def prepend_api_code(doc)
|
8
|
+
@config = doc.site.config
|
8
9
|
if doc.output =~ HEAD_END_TAG
|
9
10
|
# Insert API code before header's end if this document has one.
|
10
11
|
doc.output.gsub!(HEAD_END_TAG, %(#{api_code}#{Regexp.last_match}))
|
@@ -15,11 +16,12 @@ module Jekyll
|
|
15
16
|
|
16
17
|
private
|
17
18
|
def api_code
|
19
|
+
api_key = @config.fetch("maps", {}).fetch("google", {}).fetch("api_key", "")
|
18
20
|
<<HTML
|
19
21
|
<script type='text/javascript'>
|
20
22
|
#{js_lib_contents}
|
21
23
|
</script>
|
22
|
-
<script async defer src='https://maps.googleapis.com/maps/api/js?callback=jekyllMaps.initializeMap'></script>
|
24
|
+
<script async defer src='https://maps.googleapis.com/maps/api/js?key=#{api_key}&callback=jekyllMaps.initializeMap'></script>
|
23
25
|
<script async defer src='https://cdn.rawgit.com/googlemaps/js-marker-clusterer/gh-pages/src/markerclusterer.js'
|
24
26
|
onload='jekyllMaps.initializeCluster()'></script>
|
25
27
|
HTML
|
data/lib/jekyll-maps/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-maps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anatoliy Yastreb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|