Merge branch 'master' into master
This commit is contained in:
commit
9ec685a31b
|
@ -7,4 +7,5 @@
|
|||
/pkg/
|
||||
/spec/reports/
|
||||
/tmp/
|
||||
/bin/
|
||||
*.gem
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -9,7 +9,6 @@ group :development, :test do
|
|||
versions.delete("ruby")
|
||||
versions.delete("jekyll-seo-tag")
|
||||
versions.delete("github-pages")
|
||||
versions.delete("jekyll") # Remove this line when GitHub Pages supports 3.3.0
|
||||
|
||||
versions.each do |dep, version|
|
||||
gem dep, version
|
||||
|
|
|
@ -103,12 +103,15 @@ webmaster_verifications:
|
|||
yandex: 1234
|
||||
```
|
||||
|
||||
* `lang` - The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`.
|
||||
|
||||
The SEO tag will respect the following YAML front matter if included in a post, page, or document:
|
||||
|
||||
* `title` - The title of the post, page, or document
|
||||
* `description` - A short description of the page's content
|
||||
* `image` - URL to an image associated with the post, page, or document (e.g., `/assets/page-pic.jpg`)
|
||||
* `author` - Page-, post-, or document-specific author information (see below)
|
||||
* `lang` - Page-, post-, or document-specific language information
|
||||
|
||||
## Advanced usage
|
||||
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -1,6 +0,0 @@
|
|||
require "bundler/gem_tasks"
|
||||
require "rspec/core/rake_task"
|
||||
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
|
||||
task :default => :spec
|
|
@ -27,9 +27,8 @@ Gem::Specification.new do |spec|
|
|||
spec.require_paths = ["lib"]
|
||||
|
||||
spec.add_dependency "jekyll", "~> 3.3"
|
||||
spec.add_development_dependency "bundler", "~> 1.10"
|
||||
spec.add_development_dependency "rake", "~> 10.0"
|
||||
spec.add_development_dependency "rspec", "~> 3.3"
|
||||
spec.add_development_dependency "html-proofer", "~> 2.5"
|
||||
spec.add_development_dependency "bundler", "~> 1.14"
|
||||
spec.add_development_dependency "rspec", "~> 3.5"
|
||||
spec.add_development_dependency "html-proofer", "~> 3.6"
|
||||
spec.add_development_dependency "rubocop", "~> 0.48"
|
||||
end
|
||||
|
|
|
@ -101,6 +101,8 @@
|
|||
{% assign seo_page_image = seo_page_image | escape %}
|
||||
{% endif %}
|
||||
|
||||
{% assign seo_page_lang = page.lang | default: site.lang | default: "en_US" %}
|
||||
|
||||
{% if seo_tag.title and seo_title %}
|
||||
<title>{{ seo_title }}</title>
|
||||
{% endif %}
|
||||
|
@ -113,6 +115,8 @@
|
|||
<meta name="author" content="{{ seo_author_name }}" />
|
||||
{% endif %}
|
||||
|
||||
<meta property="og:locale" content="{{ seo_page_lang | replace:'-','_' }}" />
|
||||
|
||||
{% if seo_description %}
|
||||
<meta name="description" content="{{ seo_description }}" />
|
||||
<meta property="og:description" content="{{ seo_description }}" />
|
||||
|
@ -128,7 +132,6 @@
|
|||
{% endif %}
|
||||
|
||||
{% if seo_page_image %}
|
||||
|
||||
<meta property="og:image" content="{{ seo_page_image }}" />
|
||||
{% if page.image.height %}
|
||||
<meta property="og:image:height" content="{{ page.image.height }}" />
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
|
||||
set -ex
|
||||
|
||||
bundle exec rake spec
|
||||
bundle exec rspec
|
||||
bundle exec rubocop -S -D
|
||||
bundle exec gem build jekyll-seo-tag.gemspec
|
||||
|
|
|
@ -31,7 +31,7 @@ describe Jekyll::SeoTag do
|
|||
:check_html => true,
|
||||
:checks_to_ignore => %w(ScriptCheck LinkCheck ImageCheck),
|
||||
}
|
||||
status = HTML::Proofer.new(dest_dir, options).run
|
||||
status = HTMLProofer.check_directory(dest_dir, options).run
|
||||
expect(status).to eql(true)
|
||||
end
|
||||
|
||||
|
@ -299,6 +299,7 @@ describe Jekyll::SeoTag do
|
|||
<!-- Begin Jekyll SEO tag v#{version} -->
|
||||
<title>Foo</title>
|
||||
<meta property="og:title" content="Foo" />
|
||||
<meta property="og:locale" content="en_US" />
|
||||
<link rel="canonical" href="http://example.invalid/page.html" />
|
||||
<meta property="og:url" content="http://example.invalid/page.html" />
|
||||
<meta property="og:site_name" content="Foo" />
|
||||
|
@ -623,4 +624,38 @@ EOS
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with locale" do
|
||||
it "uses en_US when no locale is specified" do
|
||||
expected = %r!<meta property="og:locale" content="en_US" />!
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
|
||||
context "with site.lang" do
|
||||
let(:site) { make_site("lang" => "en_US") }
|
||||
|
||||
it "uses site.lang if page.lang is not present" do
|
||||
expected = %r!<meta property="og:locale" content="en_US" />!
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
|
||||
context "with page.lang" do
|
||||
let(:page) { make_page("lang" => "en_UK") }
|
||||
|
||||
it "uses page.lang if both site.lang and page.lang are present" do
|
||||
expected = %r!<meta property="og:locale" content="en_UK" />!
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with site.lang hyphenated" do
|
||||
let(:site) { make_site("lang" => "en-US") }
|
||||
|
||||
it "coerces hyphen to underscore" do
|
||||
expected = %r!<meta property="og:locale" content="en_US" />!
|
||||
expect(output).to match(expected)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
||||
require "jekyll"
|
||||
require "jekyll-seo-tag"
|
||||
require "html/proofer"
|
||||
require "html-proofer"
|
||||
|
||||
ENV["JEKYLL_LOG_LEVEL"] = "error"
|
||||
|
||||
|
|
Loading…
Reference in New Issue