Skip to content

Commit

Permalink
add a link to main docs site from redoc api docs (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
sami-alajrami authored Nov 11, 2024
1 parent 959258b commit 8433c3c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs.kosli.com/content/api_reference/v1/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
title: API V1
directLink: "/api_v1.html"
weight: 2
---
1 change: 1 addition & 0 deletions docs.kosli.com/content/api_reference/v2/_index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
title: API V2
directLink: "/api_v2.html"
weight: 1
---
28 changes: 28 additions & 0 deletions docs.kosli.com/static/api_v1.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,33 @@
}'
></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Create a MutationObserver to wait for the logo to be added to the DOM
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
// Check if the logo image is now in the DOM
const logoImage = document.querySelector(".menu-content > div:first-child > img");

if (logoImage) {
// Create a link element and wrap the logo image
const link = document.createElement("a");
link.href = "https://docs.kosli.com";
// link.target = "_blank";

// Wrap the logo image inside the link
logoImage.parentNode.insertBefore(link, logoImage);
link.appendChild(logoImage);

// Stop observing once we've found and modified the logo
observer.disconnect();
}
});
});

// Start observing the body for child additions or subtree modifications
observer.observe(document.body, { childList: true, subtree: true });
});
</script>
</body>
</html>
28 changes: 28 additions & 0 deletions docs.kosli.com/static/api_v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,33 @@
}'
></redoc>
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"> </script>
<script>
document.addEventListener("DOMContentLoaded", function() {
// Create a MutationObserver to wait for the logo to be added to the DOM
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
// Check if the logo image is now in the DOM
const logoImage = document.querySelector(".menu-content > div:first-child > img");

if (logoImage) {
// Create a link element and wrap the logo image
const link = document.createElement("a");
link.href = "https://docs.kosli.com";
// link.target = "_blank";

// Wrap the logo image inside the link
logoImage.parentNode.insertBefore(link, logoImage);
link.appendChild(logoImage);

// Stop observing once we've found and modified the logo
observer.disconnect();
}
});
});

// Start observing the body for child additions or subtree modifications
observer.observe(document.body, { childList: true, subtree: true });
});
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ require (
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo=
github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down

0 comments on commit 8433c3c

Please sign in to comment.