Current section
36 Versions
Jump to
Current section
36 Versions
Compare versions
4
files changed
+45
additions
-8
deletions
| @@ -136,7 +136,7 @@ Current Features or To-Do | |
| 136 136 | - [x] [Supports: generate kind of some sitemaps](#supports-generate-kind-of-some-sitemaps) |
| 137 137 | - [x] [News Sitemaps](#news-sitemaps) |
| 138 138 | - [x] [Video Sitemaps](#video-sitemaps) |
| 139 | - - [x] Image Sitemaps |
| 139 | + - [x] [Image Sitemaps](#image-sitemaps) |
| 140 140 | - [x] Geo Sitemaps |
| 141 141 | - [x] Mobile Sitemaps |
| 142 142 | - [x] PageMap Sitemap |
| @@ -200,6 +200,43 @@ end | |
| 200 200 | |
| 201 201 | Look at [Creating a Google News Sitemap](https://support.google.com/news/publisher/answer/74288) as required. |
| 202 202 | |
| 203 | + ### Image sitemaps |
| 204 | + |
| 205 | + ```elixir |
| 206 | + defmodule Sitemaps do |
| 207 | + use Sitemap, compress: false, host: "http://example.com" |
| 208 | + |
| 209 | + create do |
| 210 | + add "index.html", images: [ |
| 211 | + loc: "http://example.com/image.jpg", |
| 212 | + caption: "Caption", |
| 213 | + title: "Title", |
| 214 | + license: "https://github.com/ikeikeikeike/sitemap/blob/master/LICENSE", |
| 215 | + geo_location: "Limerick, Ireland", |
| 216 | + ] |
| 217 | + end |
| 218 | + end |
| 219 | + ``` |
| 220 | + |
| 221 | + ###### Generated Result |
| 222 | + |
| 223 | + ```xml |
| 224 | + <url> |
| 225 | + <loc>http://www.example.com/image.html</loc> |
| 226 | + <lastmod>2016-05-31T13:32:40Z</lastmod> |
| 227 | + <image:image> |
| 228 | + <image:loc>http://example.com/image.jpg</image:loc> |
| 229 | + <image:caption>Caption</image:caption> |
| 230 | + <image:title>Title</image:title> |
| 231 | + <image:license>https://github.com/ikeikeikeike/sitemap/blob/master/LICENSE</image:license> |
| 232 | + <image:geo_location>Limerick, Ireland</image:geo_location> |
| 233 | + </image:image> |
| 234 | + </url> |
| 235 | + ``` |
| 236 | + |
| 237 | + Look at [Image sitemaps](https://support.google.com/webmasters/answer/178636) as required. |
| 238 | + |
| 239 | + |
| 203 240 | ### Video sitemaps |
| 204 241 | |
| 205 242 | ```elixir |
| @@ -23,4 +23,4 @@ | |
| 23 23 | [{<<"app">>,<<"xml_builder">>}, |
| 24 24 | {<<"optional">>,false}, |
| 25 25 | {<<"requirement">>,<<">= 0.0.0">>}]}]}. |
| 26 | - {<<"version">>,<<"0.6.2">>}. |
| 26 | + {<<"version">>,<<"0.6.3">>}. |
| @@ -52,11 +52,11 @@ defmodule Sitemap.Builders.Url do | |
| 52 52 | defp images([data|tail], elements) do |
| 53 53 | elm = |
| 54 54 | element(:"image:image", Funcs.eraser([ |
| 55 | - element(:"image:loc", data[:loc]), |
| 56 | - element(:"image:title", data[:title]), |
| 57 | - element(:"image:license", data[:license]), |
| 58 | - element(:"image:caption", data[:caption]), |
| 59 | - element(:"image:geo_location", data[:geo_location]), |
| 55 | + element(:"image:loc", data[:loc]), |
| 56 | + (unless is_nil(data[:title]), do: element(:"image:title", data[:title])), |
| 57 | + (unless is_nil(data[:license]), do: element(:"image:license", data[:license])), |
| 58 | + (unless is_nil(data[:caption]), do: element(:"image:caption", data[:caption])), |
| 59 | + (unless is_nil(data[:geo_location]), do: element(:"image:geo_location", data[:geo_location])), |
| 60 60 | ])) |
| 61 61 | |
| 62 62 | images(tail, elements ++ [elm]) |
| @@ -9,7 +9,7 @@ defmodule Sitemap.Mixfile do | |
| 9 9 | [ |
| 10 10 | app: :sitemap, |
| 11 11 | name: "Sitemap", |
| 12 | - version: "0.6.2", |
| 12 | + version: "0.6.3", |
| 13 13 | elixir: ">= 1.0.0", |
| 14 14 | description: @description, |
| 15 15 | build_embedded: Mix.env == :prod, |