Skip to content

Commit a711368

Browse files
fix(projects): do not include docs for PR preview projects (#218)
1 parent 2f7e160 commit a711368

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

assets/js/projects.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,20 @@ $(document).ready(function(){
138138
project_repo = project_repo.toLowerCase();
139139

140140
if (docs_repo === project_repo) {
141+
let docs_url = readthedocs[docs]['urls']['documentation']
142+
try {
143+
let parsedUrl = new URL(docs_url);
144+
if (parsedUrl.host !== "docs.lizardbyte.dev") {
145+
continue;
146+
}
147+
} catch (e) {
148+
console.error("Invalid URL:", docs_url);
149+
continue;
150+
}
151+
141152
let docs_link = document.createElement("a")
142153
docs_link.className = "nav-link text-warning ms-3"
143-
docs_link.href = readthedocs[docs]['urls']['documentation']
154+
docs_link.href = docs_url
144155
docs_link.target = "_blank"
145156
repo_data_row.appendChild(docs_link)
146157

0 commit comments

Comments
 (0)