Skip to content

Redocly: Add support for content on redocly pages #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: mainframe
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions assets/css/v2/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,26 @@ nav {
[data-grid="half"] {
grid-column: span 6;
}

[data-grid="breakout"] {
Copy link
Collaborator

@lamATnginx lamATnginx Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left or right alignment is off for cards

Screenshot 2025-07-29 at 8 57 31 AM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly has to do with position of something in the Cards?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue is that if you use it on a non-direct child of the content grid, it will break. Probably should add that comment for future reference.

grid-column: 1 / -1;
width: calc(100vw - var(--sidebar-width) - 4rem);
position: relative;
left: 50%;
right: 50%;
margin-left: calc(-1 * (50vw - var(--sidebar-width) / 2 - 2rem));
margin-right: calc(-1 * (50vw - var(--sidebar-width) / 2 - 2rem));
max-width: calc(100vw - var(--sidebar-width) - 4rem);
}

@media (max-width: 68rem) {
[data-grid="breakout"] {
width: 100vw;
margin-left: -50vw;
margin-right: -50vw;
max-width: 100vw;
}
}
}

.content {
Expand Down Expand Up @@ -921,19 +941,16 @@ nav {
}
}
}

/* Allow redocly to fill the entire container */
&.content__redocly {
min-width: 100%;
margin: 0;

#api-component {
z-index: 0;
position: relative;
display: block;
max-width: 100%;
margin-block-start: 1rem;
}
}
/* Allow redocly to fill the entire container */
.content .content__redocly {
border-top: 1px solid oklch(var(--color-divider));
border-bottom: 1px solid oklch(var(--color-divider));
#api-component {
z-index: 0;
position: relative;
display: block;
max-width: 100%;
}
}

Expand Down
8 changes: 7 additions & 1 deletion exampleSite/content/test-product/redoc/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ tags:
- api
doctypes:
- reference
nd-api-reference: "./api/example.json"
---
{{< openapi spec="./api/example.json" >}}

## Introduction

Welcome to the API Reference documentation for the example book API. This documentation provides detailed information about the API endpoints, request/response formats, and other relevant details.

## API Specification
2 changes: 1 addition & 1 deletion exampleSite/content/test-product/redoc/live-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ tags:
- api
doctypes:
- reference
nd-api-reference: "./api/one.json"
---
{{< openapi spec="./api/one.json" >}}
12 changes: 9 additions & 3 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ <h1>{{ .Title }}</h1>
{{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }}
{{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }}

{{ with (index .Page.Params "nd-api-reference") }}
<div class="content__redocly" data-grid="breakout">
{{ partial "openapi.html" . }}
</div>
{{ end }}

{{ if .Page.Lastmod }}
<div class="last-modified">
{{ partial "page-meta-links" . }}
Expand All @@ -28,13 +34,13 @@ <h1>{{ .Title }}</h1>

{{ partial "version-list" . }}
{{ partial "qualtrics-feedback.html" }}

</section>
</section>
</article>
</main>





<!-- If there is a script defined in the page metadata, load it -->
{{if .Params.script}}
{{ $script := (delimit (slice "scripts" .Params.script) "/")}}
Expand Down
16 changes: 16 additions & 0 deletions layouts/partials/openapi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div>
<div id="api-component">
<api-container>
<redoc
spec-url='{{ . | relURL }}'
menu-toggle
path-in-middle-panel
required-props-first
hide-hostname="true"
show-extensions="x-f5-experimental"
nativeScrollbars
>
</redoc>
</api-container>
</div>
</div>
11 changes: 0 additions & 11 deletions layouts/redoc/single.html

This file was deleted.

4 changes: 0 additions & 4 deletions layouts/shortcodes/openapi.html

This file was deleted.