* config for split
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* update alllll the links
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* add redirect
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* add separate job for integrations build
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* Update website/netlify.toml
Co-authored-by: Dominic R <dominic@sdko.org>
Signed-off-by: Jens L. <jens@beryju.org>
* Revert "update alllll the links"
This reverts commit 872c5870a8.
* absolute relative URLs only
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* but use a plugin to rewrite them
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix external URL regex
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* make rewrite plugin more re-usable
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix the reverse links
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* lint
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix root redirect
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix rediret
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix root redirect
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
* fix redirect
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
---------
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Signed-off-by: Jens L. <jens@beryju.org>
Co-authored-by: Dominic R <dominic@sdko.org>
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			900 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			900 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * @import { Root } from "mdast";
 | 
						|
 */
 | 
						|
import { visit } from "unist-util-visit";
 | 
						|
 | 
						|
/**
 | 
						|
 * Remark plugin to transform relative links to docs to absolute URLs
 | 
						|
 * @param {Map<string, string>} rewriteMap Map of urls to rewrite where the key is the prefix to check for and the value is the domain to add
 | 
						|
 */
 | 
						|
function remarkLinkRewrite(rewriteMap) {
 | 
						|
    return () => {
 | 
						|
        /**
 | 
						|
         * @param {Root} tree The MDAST tree to transform.
 | 
						|
         */
 | 
						|
        return async (tree) => {
 | 
						|
            visit(tree, (node) => {
 | 
						|
                if (node.type !== "link") {
 | 
						|
                    return;
 | 
						|
                }
 | 
						|
                rewriteMap.forEach((v, k) => {
 | 
						|
                    if (!node.url.startsWith(k)) {
 | 
						|
                        return;
 | 
						|
                    }
 | 
						|
                    node.url = `${v}${node.url}`;
 | 
						|
                });
 | 
						|
            });
 | 
						|
        };
 | 
						|
    };
 | 
						|
}
 | 
						|
 | 
						|
export default remarkLinkRewrite;
 |