jekyll-crosspost-to-medium 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 014f7c663962554bbb1f39e9a6889cce44064fde
4
- data.tar.gz: 13d8a678881304d719cf326237494773eef4b161
3
+ metadata.gz: f3b1e943bdd843b23b8c8cdbe2c8ccf280c4e868
4
+ data.tar.gz: 2302f1fea944203a5a998b94a1695cdcaba87cf3
5
5
  SHA512:
6
- metadata.gz: 4abdd83a7f67d103e4c8d30d8a84ec2e8bcf54f4dafae45b211e718216bd9b0c79df4c547a1f685ef431f1ed45ce2225c3cac1748dc5265349938e9869b08b51
7
- data.tar.gz: ab179d87375bfd7eea281957899badaa6e0ad54756434eea0a968759a3c787d0a03562bcc3851c8cec1133b63657cca91c3145af0870a8298bc46638b4fcfa0e
6
+ metadata.gz: 06f84a5d44987eeddc0c40b8f2c3cf27adc98fb75f964bc4f36ef9c49c258a410d54a849d3a165970084355a377d2b47fa4bb770e9e69dd50fe38d8bc971e8dd
7
+ data.tar.gz: c86e6be2b2dacc5c113ae5974fb7c948b79052f91f054595be5c49e3a10bf337cc39f1aa0ac642a6149fcef1cb079cf3d26d8f2a5c1dcb6ae218b11fb15c6954
@@ -90,9 +90,6 @@ module Jekyll
90
90
  content = markdown_converter.convert(post.content)
91
91
  # Render any plugins
92
92
  content = (Liquid::Template.parse content).render @site.site_payload
93
- # Update absolute URLs
94
- content = content.gsub /href=(["'])\//, "href=\1#{@site.config['url']}/"
95
- content = content.gsub /src=(["'])\//, "src=\1#{@site.config['url']}/"
96
93
 
97
94
  url = "#{@site.config['url']}#{post.url}"
98
95
  title = post.title
@@ -106,10 +103,17 @@ module Jekyll
106
103
 
107
104
 
108
105
  def crosspost_payload(crossposted, post, content, title, url)
106
+ # Update any absolute URLs
107
+ content = content.gsub /href=(["'])\//, "href=\"\1#{@site.config['url']}/"
108
+ content = content.gsub /src=(["'])\//, "src=\"\1#{@site.config['url']}/"
109
+
109
110
  # Prepend the title and add a link back to originating site
110
111
  content.prepend("<h1>#{title}</h1>")
111
112
  content << "<p><i>This article was originally posted <a href=\"#{url}\" rel=\"canonical\">on my own site</a>.</i></p>"
112
113
 
114
+ # Save canonical URL
115
+ canonical_url = url
116
+
113
117
  # Strip domain name from the URL we check against
114
118
  url = url.sub(/^#{@site.config['url']}?/,'')
115
119
 
@@ -122,7 +126,7 @@ module Jekyll
122
126
  'tags' => post.data['tags'],
123
127
  'publishStatus' => @settings['status'] || "public",
124
128
  'license' => @settings['license'] || "all-rights-reserved",
125
- 'canonicalUrl' => url
129
+ 'canonicalUrl' => canonical_url
126
130
  }
127
131
 
128
132
  crosspost_to_medium(payload)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-crosspost-to-medium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Gustafson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: aaron@easy-designs.net