jekyll-alternate-permalinks 0.1.1 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/jekyll/alternate/permalinks.rb +28 -25
- data/lib/jekyll-alternate-permalinks.rb +8 -0
- metadata +3 -4
- data/lib/jekyll/alternate/permalinks/version.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08d5f1270f1d40d1936f70357c6d3db6e29374d8cee2ea1ce5f02b187def5388'
|
4
|
+
data.tar.gz: 38569d0722472d5e4e9f0b710da653e2173bb045fd20e0986a38992617b6f65b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f7be012f196cd706d4cd38d43bb2f8b3ddcee3e26cf9e1616ef81e816a08fc994b30af58b2ac3bd79fe2a0e6156cab2f16c5f7ff254b20a1c628387a57d9ae6
|
7
|
+
data.tar.gz: 06c18eb7c39c66428770af37521b4d9b02f66c45409d1eee483b2819efee29ef1cbc723552ff108f7ea0992b8cf59471fba531c2667f6ba6281a555225ffc2d9
|
data/CHANGELOG.md
CHANGED
@@ -2,31 +2,34 @@
|
|
2
2
|
|
3
3
|
require 'pathname'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
5
|
+
module Jekyll
|
6
|
+
module AlternatePermalinks
|
7
|
+
extend self
|
8
|
+
|
9
|
+
def render(page)
|
10
|
+
return unless page.data['alternate-permalinks'].is_a? Array
|
11
|
+
|
12
|
+
site = page.site
|
13
|
+
|
14
|
+
# Get a pathname for the file
|
15
|
+
path = Pathname.new(page.destination(site.dest))
|
16
|
+
|
17
|
+
# Create a symlink for each alternate permalink
|
18
|
+
page.data['alternate-permalinks'].each do |alt|
|
19
|
+
alt = Jekyll::PathManager.join(alt, 'index.html') if alt.end_with? '/'
|
20
|
+
|
21
|
+
alt_path = Pathname.new(site.in_dest_dir(alt))
|
22
|
+
|
23
|
+
if alt_path.exist?
|
24
|
+
Jekyll.logger.warn 'Permalinks:', "#{alt_path} already exists, skipping"
|
25
|
+
else
|
26
|
+
relative_path = path.relative_path_from(alt_path.dirname)
|
27
|
+
|
28
|
+
Jekyll.logger.info 'Permalinks:', "Symlink from #{relative_path} to #{alt}"
|
29
|
+
|
30
|
+
FileUtils.mkdir_p(alt_path.dirname)
|
31
|
+
File.symlink(relative_path, alt_path)
|
32
|
+
end
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -1,3 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'jekyll/alternate/permalinks'
|
4
|
+
|
5
|
+
Jekyll::Hooks.register :documents, :post_write do |document|
|
6
|
+
Jekyll::AlternatePermalinks.render document
|
7
|
+
end
|
8
|
+
|
9
|
+
Jekyll::Hooks.register :pages, :post_write do |page|
|
10
|
+
Jekyll::AlternatePermalinks.render page
|
11
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-alternate-permalinks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Prevents broken links when renaming articles by keeping a list of previous
|
14
14
|
permalinks and creating links between them
|
@@ -26,7 +26,6 @@ files:
|
|
26
26
|
- README.md
|
27
27
|
- lib/jekyll-alternate-permalinks.rb
|
28
28
|
- lib/jekyll/alternate/permalinks.rb
|
29
|
-
- lib/jekyll/alternate/permalinks/version.rb
|
30
29
|
homepage: https://0xacab.org/sutty/jekyll/jekyll-alternate-permalinks
|
31
30
|
licenses:
|
32
31
|
- GPL-3.0
|
@@ -59,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '0'
|
61
60
|
requirements: []
|
62
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.26
|
63
62
|
signing_key:
|
64
63
|
specification_version: 4
|
65
64
|
summary: Creates links from previous permalinks to the current one
|