Skip to content

Commit fe57328

Browse files
authored
Fix doc js initialization (#1736)
1. Fix `collapsedSections is not defined` error. PyTorch Sphinx theme seems to expect that `collapsedSections` variable to be defined before its theme.js is executed. 2. Overwrite the link to GitHub project to torchtext So that documentation link to torchtext's repository instead of PyTorch core.
1 parent f2fdae2 commit fe57328

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

docs/source/_templates/layout.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
#}
5555

5656
{%- block footer %}
57-
57+
<script type="text/javascript">
58+
var collapsedSections = [];
59+
</script>
5860
{{ super() }}
5961
<script type="text/javascript">
6062
$(document).ready(function() {
@@ -69,6 +71,17 @@
6971
$(".pytorch-call-to-action-links a[data-response='Run in Google Colab']").attr("href", colabLink);
7072
$(".pytorch-call-to-action-links a[data-response='View on Github']").attr("href", githubLink);
7173
}
74+
75+
// Overwrite the link to GitHub project
76+
var overwrite = function(_) {
77+
if ($(this).length > 0) {
78+
$(this)[0].href = "https://github.com/pytorch/text"
79+
}
80+
}
81+
// PC
82+
$(".main-menu a:contains('GitHub')").each(overwrite);
83+
// Mobile
84+
$(".main-menu a:contains('Github')").each(overwrite);
7285
});
7386
</script>
7487
{% endblock %}

0 commit comments

Comments
 (0)