File tree Expand file tree Collapse file tree 3 files changed +8
-14
lines changed
Expand file tree Collapse file tree 3 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -178,16 +178,22 @@ onclick = (event) ->
178178 link = $ .eventTarget (event)
179179 link = link .parentNode while link and link .tagName isnt ' A'
180180
181- if link and not link .target and isSameOrigin (link .href )
181+ if link and not link .target and isSameOrigin (link .href ) and isSameOriginDifferentDoc (link)
182182 event .preventDefault ()
183183 path = link .pathname + link .search + link .hash
184184 path = path .replace / ^ \/\/ + / , ' /' # IE11 bug
185185 page .show (path)
186+
186187 return
187188
188189isSameOrigin = (url ) ->
189190 url .indexOf (" #{ location .protocol } //#{ location .hostname } " ) is 0
190191
192+ isSameOriginDifferentDoc = (url ) ->
193+ console .log (url .pathname )
194+ console .log (location .pathname )
195+ url .pathname == location .pathname
196+
191197updateCanonicalLink = ->
192198 @canonicalLink ||= document .head .querySelector (' link[rel="canonical"]' )
193199 @canonicalLink .setAttribute (' href' , " https://#{ location .host }#{ location .pathname } " )
Original file line number Diff line number Diff line change @@ -96,15 +96,5 @@ def clean_path(path)
9696 path = path . gsub %r{\+ } , '_plus_'
9797 path
9898 end
99-
100- def path_to_root
101- if subpath == ''
102- return '../'
103- else
104- previous_dirs = subpath . scan ( /\/ / )
105- return '../' * previous_dirs . length
106- end
107- end
108-
10999 end
110100end
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ class ExternalUrlsFilter < Filter
66 def call
77 if context [ :external_urls ]
88
9- root = path_to_root
10-
119 css ( 'a' ) . each do |node |
1210
1311 next unless anchorUrl = node [ 'href' ]
@@ -24,7 +22,7 @@ def call
2422
2523 context [ :external_urls ] . each do |host , name |
2624 if url . host . to_s . match? ( host )
27- node [ 'href' ] = root + name + url . path . to_s + '#' + url . fragment . to_s
25+ node [ 'href' ] = '/' + name + url . path . to_s + '#' + url . fragment . to_s
2826 end
2927 end
3028
You can’t perform that action at this time.
0 commit comments