-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #346 from nstapelbroek/set-apidocs-title
feat: use config.Info.Title as the page title in the API docs
- Loading branch information
Showing
2 changed files
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,13 +412,17 @@ func NewAPI(config Config, a Adapter) API { | |
openAPIPath = path.Join(prefix, openAPIPath) | ||
} | ||
ctx.SetHeader("Content-Type", "text/html") | ||
title := "Elements in HTML" | ||
if config.Info != nil && config.Info.Title != "" { | ||
title = config.Info.Title + " Reference" | ||
} | ||
ctx.BodyWriter().Write([]byte(`<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="referrer" content="same-origin" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
<title>Elements in HTML</title> | ||
<title>` + title + `</title> | ||
<!-- Embed elements Elements via Web Component --> | ||
<link href="https://unpkg.com/@stoplight/[email protected]/styles.min.css" rel="stylesheet" /> | ||
<script src="https://unpkg.com/@stoplight/[email protected]/web-components.min.js" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ router.Get("/docs", func(w http.ResponseWriter, r *http.Request) { | |
<meta charset="utf-8" /> | ||
<meta name="referrer" content="same-origin" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
<title>Elements in HTML</title> | ||
<title>Docs Example reference</title> | ||
<!-- Embed elements Elements via Web Component --> | ||
<link href="https://unpkg.com/@stoplight/[email protected]/styles.min.css" rel="stylesheet" /> | ||
<script src="https://unpkg.com/@stoplight/[email protected]/web-components.min.js" | ||
|