File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ const emitExdocLoaded = () => {
1010 window . dispatchEvent ( new Event ( 'exdoc:loaded' ) )
1111}
1212
13+ const maybeMetaRedirect = ( visit , { page} ) => {
14+ const match = page . html . match ( / < m e t a \s + h t t p - e q u i v \s * = \s * [ " ' ] r e f r e s h [ " ' ] \s + c o n t e n t \s * = \s * [ " ' ] \d + \s * ; \s * u r l \s * = \s * ( [ ^ " ' ] + ) [ " ' ] / i)
15+
16+ if ( match && match [ 1 ] ) {
17+ visit . abort ( )
18+ window . location . href = match [ 1 ]
19+ }
20+ }
21+
1322window . addEventListener ( 'DOMContentLoaded' , emitExdocLoaded )
1423
1524if ( ! isEmbedded && window . location . protocol !== 'file:' ) {
@@ -23,6 +32,7 @@ if (!isEmbedded && window.location.protocol !== 'file:') {
2332 } ,
2433 linkSelector : 'a[href]:not([href^="/"]):not([href^="http"])' ,
2534 hooks : {
35+ 'page:load' : maybeMetaRedirect ,
2636 'page:view' : emitExdocLoaded
2737 } ,
2838 plugins : [ new SwupA11yPlugin ( ) , new SwupProgressPlugin ( { delay : 500 } ) ]
You can’t perform that action at this time.
0 commit comments