docsy
docsy copied to clipboard
broken link on swagger ui
I'm seeing a broken to the json file when using the swaggerui shortcode.
The page has this content:
---
title: swaggerExample
linkTitle: swaggerExample
type: swagger
---
{{< swaggerui src="swaggerExample.json" >}}
It renders fine, but under the title it shows this:
<a target="_blank" href="about:blank" rel="noopener noreferrer" class="link">
<span class="url"><!-- react-text: 57 --> <!-- /react-text --><!-- react-text: 58 --> swaggerExample.json<!-- /react-text --><!-- react-text: 59 --> <!-- /react-text --></span>
</a>
Is this under docsy's scope or is it a bug with swaggerUi ?
I tried to look at the code but didn't find any hint of what could be the problem.
Happens the same with me.
Might be a problem with SwaggerUI as I don't remember there being any problems with the integration with Docsy before, but let me look into it. @theletterf if you're around do you want to take a look too?
OK, I get it now. That's the intended behavior in Swagger UI. See https://petstore.swagger.io/ for example. The URL to the specs appear beneath the title.
There it works @theletterf since the href
is set:
<a target="_blank" href="https://petstore.swagger.io/v2/swagger.json" rel="noopener noreferrer" class="link"><span class="url"> https://petstore.swagger.io/v2/swagger.json</span></a>
In my case, and I believe in @brunoamaral's as well, href contains about:blank
.
Going to try this on my machine and will let you know.
I've tested this using https://github.com/google/docsy-example and a sample PetStore OpenAPI 3.0 file from SwaggerHub.
- I've placed the file under
content/en/
- I've used your code in
content/en/docs/Examples/_index.md
- The
config.toml
file hasbaseURL
set to/
The swaggerui
shortcode uses relURL
to fetch the file: https://github.com/google/docsy/blob/master/layouts/shortcodes/swaggerui.html
I'd bet this issue has something to do with absURL vs relURL, or with a baseURL issue. Could you have a look at your setup?
Hi @theletterf: is this still an problem?
@chalin Probably, but would only lead to edits to the docs, I think.