Skip to content

Commit 2dc81cd

Browse files
Add Redirect Feature or Error Documentation Links (#134)
* Include the errors directory when building * Add example error page for redirect * Use `redirect` and not `redirect_url` `redirect_url` bypasses the conceptual processing since it runs an internal built in process within docfx to generate the redirect page. * Replace `.md` in redirect url with `.html`
1 parent 27753ae commit 2dc81cd

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

docfx.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"foundation/**/*.md",
4141
"roadmap/**/*.md",
4242
"roadmap/**/*.yml",
43+
"errors/**/*.md",
4344
"toc.yml",
4445
"*.md"
4546
],

errors/setupwine/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
redirect: ../../articles/tutorials/building_2d_games/02_getting_started/index.md?tabs=windows#setup-wine-for-effect-compilation-macos-and-linux-only
3+
---
4+
5+
[url_validation](../../articles/tutorials/building_2d_games/02_getting_started/index.md?tabs=windows#setup-wine-for-effect-compilation-macos-and-linux-only)

templates/monogame/conceptual.extension.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
*/
44
exports.preTransform = function (model) {
55

6+
// Handle redirect urls that end with .md
7+
if(model.redirect) {
8+
model.redirect = model.redirect.replace(/\.md/g, '.html');
9+
}
610

711
// For layout pages, ignore injecting title and description as header and
812
// first paragraph

templates/monogame/layout/_master.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
{{!include(/^public/.*/)}}
33
<!DOCTYPE html>
44
<html {{#_lang}}lang="{{_lang}}"{{/_lang}}>
5-
{{#redirect_url}}
5+
{{#redirect}}
66
{{>partials/redirect}}
7-
{{/redirect_url}}
7+
{{/redirect}}
88

9-
{{^redirect_url}}
9+
{{^redirect}}
1010
<head>
1111
{{>partials/head}}
1212
</head>
@@ -81,5 +81,5 @@
8181
<script type="text/javascript" src="/public/injectDonateButton.js"></script>
8282
<script type="text/javascript" src="/public/questionAnswer.js"></script>
8383
</body>
84-
{{/redirect_url}}
84+
{{/redirect}}
8585
</html>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<meta charset="utf-8"/>
22
<title>Redirecting&hellip;</title>
33
<link rel="canonical" href="{{ redirect.to | url }}"/>
4-
<script>location = '{{redirect_url}}';</script>
5-
<meta http-equiv="refresh" content="0; url={{redirect_url}}"/>
4+
<script>location = '{{redirect}}';</script>
5+
<meta http-equiv="refresh" content="0; url={{redirect}}"/>
66
<meta name="robots" content="noindex"/>
77
<h1>Redirecting&hellip;</h1>
8-
<a href="{{redirect_url}}">Click here if you are not redirected.</a>
8+
<a href="{{redirect}}">Click here if you are not redirected.</a>

0 commit comments

Comments
 (0)