Skip to content

Commit 39955c4

Browse files
committed
Add missing redirects
1 parent 0dcf280 commit 39955c4

2 files changed

Lines changed: 43 additions & 8 deletions

File tree

‎gen_redirects.py‎

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,38 @@ def main(args: list[str]) -> int:
2121
dirs = dict[str, list[str]]()
2222
for key, value in data.items():
2323
dir = posixpath.dirname(key)
24+
ext = posixpath.splitext(key)[1]
2425
if dir in dirs:
2526
dirs[dir].append(key)
2627
else:
2728
dirs[dir] = [key]
28-
content: list[Any] = config["build"]["content"]
29-
content.append({"files": posixpath.relpath(key, "content"), "src": "content"})
3029
os.makedirs(dir, exist_ok=True)
31-
with open(key, mode="w", encoding="utf-8") as f:
32-
f.write(f"""---
30+
if ext == ".md":
31+
content: list[Any] = config["build"]["content"]
32+
content.append({"files": posixpath.relpath(key, "content"), "src": "content"})
33+
with open(key, mode="w", encoding="utf-8") as f:
34+
f.write(f"""---
3335
redirect_url: {value}
3436
---
3537
""")
38+
elif ext == ".html":
39+
resource: list[Any] = config["build"]["resource"]
40+
resource.append({"files": posixpath.relpath(key, "content"), "src": "content"})
41+
with open(key, mode="w", encoding="utf-8") as f:
42+
f.write(f"""<!DOCTYPE html>
43+
<html>
44+
<head>
45+
<meta charset="utf-8">
46+
<meta http-equiv="refresh" content="0;URL='{value}'">
47+
</head>
48+
</html>
49+
""")
50+
else:
51+
print("Unknown file type:", key, file=sys.stderr)
3652

3753
for dir, files in dirs.items():
38-
with open(posixpath.join(dir, ".gitignore"), "w") as f:
54+
with open(posixpath.join(dir, ".gitignore"), "a") as f:
55+
f.write("\n")
3956
f.writelines("/" + posixpath.basename(file) + "\n" for file in files)
4057
f.write("/.gitignore\n")
4158

‎redirects.json‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@
2929
"content/common/Semantic Model/direct-lake-sql-model.md": "/features/Semantic Model/direct-lake-sql-model.html",
3030
"content/common/Semantic Model/direct-query-over-as.md": "/features/Semantic Model/direct-query-over-as.html",
3131
"content/common/Semantic Model/semantic-model-types.md": "/features/Semantic Model/semantic-model-types.html",
32+
"content/common/common-features.md": "/getting-started/Getting-Started-te2.html",
3233
"content/common/desktop-limitations.md": "/getting-started/desktop-limitations.html",
3334
"content/common/policies.md": "/references/policies.html",
3435
"content/common/save-to-folder.md": "/features/save-to-folder.html",
3536
"content/common/script-helper-methods.md": "/features/script-helper-methods.html",
37+
"content/common/tmdl-common.md": "/features/tmdl.html",
38+
"content/common/toc.html": "/index.html",
3639
"content/common/using-bpa-sample-rules-expressions.md": "/features/using-bpa-sample-rules-expressions.html",
40+
"content/common/using-bpa.md": "/features/using-bpa.html",
3741
"content/common/xmla-as-connectivity.md": "/how-tos/xmla-as-connectivity.html",
38-
"content/onboarding/as-cicd.md": "/todo/as-cicd.html",
42+
"content/onboarding/as-cicd.md": "/getting-started/as-cicd.html",
3943
"content/onboarding/boosting-productivity-te3.md": "/getting-started/boosting-productivity-te3.html",
4044
"content/onboarding/bpa.md": "/getting-started/bpa.html",
4145
"content/onboarding/creating-and-testing-dax.md": "/getting-started/creating-and-testing-dax.html",
@@ -48,31 +52,40 @@
4852
"content/onboarding/migrate-from-desktop.md": "/getting-started/migrate-from-desktop.html",
4953
"content/onboarding/migrate-from-te2.md": "/getting-started/migrate-from-te2.html",
5054
"content/onboarding/migrate-from-vs.md": "/getting-started/migrate-from-vs.html",
55+
"content/onboarding/optimizing-workflow-workspace-mode.md": "/getting-started/optimizing-workflow-workspace-mode.html",
5156
"content/onboarding/parallel-development.md": "/getting-started/parallel-development.html",
5257
"content/onboarding/personalizing-te3.md": "/getting-started/personalizing-te3.html",
53-
"content/onboarding/powerbi-cicd.md": "/todo/powerbi-cicd.html",
58+
"content/onboarding/powerbi-cicd.md": "/getting-started/powerbi-cicd.html",
5459
"content/onboarding/refresh-preview-query.md": "/getting-started/refresh-preview-query.html",
60+
"content/onboarding/toc.html": "/getting-started/toc.html",
5561
"content/te2/Advanced-Filtering-of-the-Explorer-Tree.md": "/how-tos/Advanced-Filtering-of-the-Explorer-Tree.html",
5662
"content/te2/Advanced-Scripting.md": "/how-tos/Advanced-Scripting.html",
63+
"content/te2/Advanced-features.md": "/getting-started/Getting-Started-te2.html",
5764
"content/te2/Best-Practice-Analyzer-Improvements.md": "/features/Best-Practice-Analyzer.html",
65+
"content/te2/Best-Practice-Analyzer.md": "/features/Best-Practice-Analyzer.html",
5866
"content/te2/Command-line-Options.md": "/features/Command-line-Options.html",
5967
"content/te2/Custom-Actions.md": "/features/Custom-Actions-hidden.html",
6068
"content/te2/FAQ.md": "/references/FAQ.html",
69+
"content/te2/Features-at-a-glance.md": "/getting-started/Getting-Started-te2.html",
6170
"content/te2/FormatDax.md": "/references/FormatDax.html",
6271
"content/te2/Getting-Started.md": "/getting-started/Getting-Started-te2.html",
6372
"content/te2/Importing-Tables.md": "/how-tos/Importing-Tables.html",
6473
"content/te2/Keyboard-Shortcuts.md": "/references/Keyboard-Shortcuts2.html",
65-
"content/te2/Maintaining-Calculations-using-Scripting.md": "/todo/Maintaining-Calculations-using-Scripting.html",
6674
"content/te2/Master-model-pattern.md": "/how-tos/Master-model-pattern.html",
75+
"content/te2/Power-BI-Desktop-Integration.md": "/getting-started/Power-BI-Desktop-Integration.html",
6776
"content/te2/Roadmap.md": "/references/Roadmap2-h.html",
6877
"content/te2/SQL-Server-2017-support.md": "/references/SQL-Server-2017-support-h.html",
6978
"content/te2/TabularEditor.TOMWrapper.md": "/references/TabularEditor.TOMWrapper-h.html",
79+
"content/te2/Training-Webinar-for-Tabular-Editor.md": "/getting-started/Training-Webinar-for-Tabular-Editor.html",
7080
"content/te2/Useful-script-snippets.md": "/features/Useful-script-snippets.html",
7181
"content/te2/Workspace-Database.md": "/features/Workspace-Database.html",
7282
"content/te2/gdpr-delete.md": "/security/gdpr-delete.html",
7383
"content/te2/importing-tables-from-excel.md": "/how-tos/importing-tables-from-excel.html",
7484
"content/te2/incremental-refresh.md": "/how-tos/incremental-refresh2-h.html",
85+
"content/te2/privacy-policy.md": "/security/privacy-policy.html",
86+
"content/te2/toc.html": "/getting-started/Getting-Started-te2.html",
7587
"content/te3/azure-marketplace.md": "/getting-started/azure-marketplace.html",
88+
"content/te3/desktop-limitations.md": "/getting-started/desktop-limitations.html",
7689
"content/te3/editions.md": "/getting-started/editions.html",
7790
"content/te3/features/code-actions.md": "/features/code-actions.html",
7891
"content/te3/features/csharp-scripts.md": "/features/csharp-scripts.html",
@@ -174,10 +187,12 @@
174187
"content/te3/other/release-notes/beta-18_4.md": "/references/release-notes/beta-18_4.html",
175188
"content/te3/other/release-notes/beta-18_5.md": "/references/release-notes/beta-18_5.html",
176189
"content/te3/other/roadmap.md": "/references/roadmap.html",
190+
"content/te3/other/te3-eula.md": "/security/te3-eula.html",
177191
"content/te3/other/third-party-notices.md": "/security/third-party-notices.html",
178192
"content/te3/powerbi-xmla-pbix-workaround.md": "/how-tos/powerbi-xmla-pbix-workaround.html",
179193
"content/te3/powerbi-xmla.md": "/tutorials/powerbi-xmla.html",
180194
"content/te3/proxy-settings.md": "/troubleshooting/proxy-settings.html",
195+
"content/te3/toc.html": "/index.html",
181196
"content/te3/troubleshooting/calendar-blank-value.md": "/troubleshooting/calendar-blank-value.html",
182197
"content/te3/troubleshooting/direct-lake-entity-updates-reverting.md": "/troubleshooting/direct-lake-entity-updates-reverting.html",
183198
"content/te3/troubleshooting/locale-not-supported.md": "/troubleshooting/locale-not-supported.html",
@@ -189,6 +204,7 @@
189204
"content/te3/tutorials/data-security/data-security-setup-rls.md": "/tutorials/data-security/data-security-setup-rls.html",
190205
"content/te3/tutorials/data-security/data-security-testing.md": "/tutorials/data-security/data-security-testing.html",
191206
"content/te3/tutorials/direct-lake-guidance.md": "/tutorials/direct-lake-guidance.html",
207+
"content/te3/tutorials/importing-tables.md": "/tutorials/importing-tables.html",
192208
"content/te3/tutorials/incremental-refresh/incremental-refresh-about.md": "/tutorials/incremental-refresh/incremental-refresh-about.html",
193209
"content/te3/tutorials/incremental-refresh/incremental-refresh-modify.md": "/tutorials/incremental-refresh/incremental-refresh-modify.html",
194210
"content/te3/tutorials/incremental-refresh/incremental-refresh-schema.md": "/tutorials/incremental-refresh/incremental-refresh-schema.html",
@@ -197,6 +213,8 @@
197213
"content/te3/tutorials/new-as-model.md": "/tutorials/new-as-model.html",
198214
"content/te3/tutorials/new-pbi-model.md": "/tutorials/new-pbi-model.html",
199215
"content/te3/tutorials/udfs.md": "/tutorials/udfs.html",
216+
"content/te3/tutorials/workspace-mode.md": "/tutorials/workspace-mode.html",
217+
"content/te3/views/bpa-view.md": "/features/views/bpa-view.html",
200218
"content/te3/views/data-refresh-view.md": "/features/views/data-refresh-view.html",
201219
"content/te3/views/find-replace.md": "/features/views/find-replace.html",
202220
"content/te3/views/macros-view.md": "/features/views/macros-view.html",

0 commit comments

Comments
 (0)