Skip to content

Make apireference layout generic #1712

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 2 commits into
base: main
Choose a base branch
from
Open

Make apireference layout generic #1712

wants to merge 2 commits into from

Conversation

cmilesb
Copy link
Contributor

@cmilesb cmilesb commented Jun 16, 2025

Was playing around with the Langcache OpenAPI spec to see if it could work with the apireference layout, and I was able to make a few changes to the layout to make it generic. Now, all you need is an OpenAPI spec (YAML or JSON) to get the same layout as the Redis Cloud API docs.

Here's what the filestructure should look like to use the apireference layout:

<containing-folder>/
├---------api-reference/
|                  └------<spec-file-name>
|
├---------api-reference.md
|
└---------<other files>

Here's what api-reference.md should look like:

---
Title: <API Name>
linkTitle: API reference
layout: apireference
type: page
params:
  sourcefile: ./<spec-file-name> (optional - only specify if not using ./openapi.json)
  backLink: <path-to-page> (optional - only specify if not using the parent page)
---

@cmilesb cmilesb requested review from paoloredis and a team June 16, 2025 17:33
@cmilesb cmilesb self-assigned this Jun 16, 2025
Copy link
Contributor

github-actions bot commented Jun 16, 2025

Copy link
Collaborator

@dwdougherty dwdougherty left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -2,7 +2,7 @@
<html>

<head>
<title>Redis Cloud API</title>
<title>{{ .Title }}</title>
{{ partial "scss.html" (dict "path" "scss/style.scss") }}
{{ partial "css.html" (dict "path" "css/index.css") }}
{{ $relref := printf "%s%s" .Site.BaseURL "operate/rc/api/" }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll have to inject the baseurl dynamically as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I fixed that in fbaecdb, let me know what you think.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good.

@paoloredis
Copy link
Collaborator

I think it would make sense to remove layouts/_default/rdiapireference.html as part of this PR.

Copy link
Contributor

@andy-stark-redis andy-stark-redis left a comment

Choose a reason for hiding this comment

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

Looks good. J'approve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants