File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 4444 {% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
4545{% endif %}
4646
47+ {% if page.author %}
48+ {% if page.author.name %}
49+ {% assign seo_author_name = page.author.name %}
50+ {% else %}
51+ {% assign seo_author_name = page.author %}
52+ {% endif %}
53+
54+ {% if page.author.twitter %}
55+ {% assign seo_author_twitter = page.author.twitter %}
56+ {% else %}
57+ {% assign seo_author_twitter = page.author %}
58+ {% endif %}
59+ {% endif %}
60+ {% if seo_author_twitter %}
61+ {% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" %}
62+ {% endif %}
63+
4764{% if seo_title %}
4865 < title > {{ seo_title }}</ title >
4966{% endif %}
106123 {% if page.image %}
107124 < meta name ="twitter:image " content ="{{ page.image | escape }} " />
108125 {% endif %}
109- {% if page.author %}
110- < meta name ="twitter:creator " content ="@ {{ page.author | replace: " @ ","" }}" />
126+ {% if seo_author_twitter %}
127+ < meta name ="twitter:creator " content ="{{ seo_author_twitter }} " />
111128 {% endif %}
112129{% endif %}
113130
Original file line number Diff line number Diff line change 166166 expect ( subject . render ( context ) ) . to match ( expected )
167167 end
168168
169+ it "supports author data as an object" do
170+ site = site ( { "twitter" => { "username" => "jekyllrb" } } )
171+ page = page ( { "author" => { "twitter" => "@test" } } )
172+ context = context ( { :site => site , :page => page } )
173+ expected = %r!<meta name="twitter:creator" content="@test" />!
174+ expect ( subject . render ( context ) ) . to match ( expected )
175+ end
176+
169177 it "outputs valid HTML" do
170178 site . process
171179 options = {
You can’t perform that action at this time.
0 commit comments