You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That way we don’t need to create redirect specific configurations for the web server or the static site generator.
Rationale
Under MediaWiki we can create a page redirection. Let’s assume we asked MediaWiki to "leave a redirect" from /wiki/a/b/c to redirect the visitor web browser to /wiki/d/e/f automatically.
Page redirect are created for many purposes. They can be done by a user who explicitly added the appropriate wiki code, or when a user uses the "Move" function.
In the end, MediaWiki basically creates a new wiki document revision with special wiki code in the following format #REDIRECT [[d/e/f]].
Notice that what’s after #REDIRECT is valid MediaWiki flavored Wikitext. When parsing MediaWiki dumpBackup XML file, we also have another way of knowing if a wiki page has a redirect. Since our script loops through the XML file, we can get this information from a <page> described like this <redirect title="d/e/f" />.
Since we want to keep only files that actually has content and that git supports similar desired outcome, we’ll adress the use case with what’s available to us within Git.
Expected outcome
When a MediaWiki page is declared as "redirect", we’ll instead do:
Delete the file (e.g. git rm -- a/b/c)
Look where the redirect points to (e.g. d/e/f)
Ensure the targeted file exists
true: Create a symbolic link (e.g. git ln -s d/e/f a/b/c)
false: Do nothing.
Commit with enforced author and action date (e.g. git commit --author="John Doe <[email protected]>" --date="Thu, 13 Sep 2012 20:50:35 +0000" --message="Original commit message")
Things to keep in mind
Redirect doesn’t mean the page has been deleted, but the most common use-case is when a page content has been removed and we want to redirect the user elsewhere.
The text was updated successfully, but these errors were encountered:
Let’s handle redirects, using Git!
That way we don’t need to create redirect specific configurations for the web server or the static site generator.
Rationale
Under MediaWiki we can create a page redirection. Let’s assume we asked MediaWiki to "leave a redirect" from
/wiki/a/b/c
to redirect the visitor web browser to/wiki/d/e/f
automatically.Page redirect are created for many purposes. They can be done by a user who explicitly added the appropriate wiki code, or when a user uses the "Move" function.
In the end, MediaWiki basically creates a new wiki document revision with special wiki code in the following format
#REDIRECT [[d/e/f]]
.Notice that what’s after
#REDIRECT
is valid MediaWiki flavored Wikitext. When parsing MediaWiki dumpBackup XML file, we also have another way of knowing if a wiki page has a redirect. Since our script loops through the XML file, we can get this information from a<page>
described like this<redirect title="d/e/f" />
.Since we want to keep only files that actually has content and that git supports similar desired outcome, we’ll adress the use case with what’s available to us within Git.
Expected outcome
When a MediaWiki page is declared as "redirect", we’ll instead do:
git rm -- a/b/c
)d/e/f
)git ln -s d/e/f a/b/c
)git commit --author="John Doe <[email protected]>" --date="Thu, 13 Sep 2012 20:50:35 +0000" --message="Original commit message"
)Things to keep in mind
The text was updated successfully, but these errors were encountered: