Skip to content

Commit c492191

Browse files
committed
feat: Added Markdown generation for markdown versions of all pages.
- updated llms.txt page buit by hugo - added llms-full.txt
1 parent 293abfd commit c492191

7 files changed

Lines changed: 332 additions & 86 deletions

File tree

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ UNAME=$(shell uname -s)
55
# Also because of the proxy 127.0.0.1 doesn't work as a bind address.
66
ifeq ($(UNAME), Darwin)
77
PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer -p 4000:4000
8-
HUGO_SERVER_OPTS = --bind 0.0.0.0
8+
HUGO_SERVER_OPTS = --bind 0.0.0.0
99
else
1010
PODMAN_OPTS ?= -it --security-opt label=disable --pull=newer --net=host
1111
endif
@@ -35,12 +35,17 @@ test: htmltest ## Runs tests
3535

3636
.PHONY: build
3737
build: ## Build the website locally in the public/ folder
38-
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER)
38+
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) $(HOMEPAGE_CONTAINER) -c "hugo && node utils/generate-md.js"
39+
40+
.PHONY: generate-md
41+
generate-md: ## Generate Markdown versions of all pages in public/
42+
node utils/generate-md.js
3943

4044
.PHONY: serve
4145
serve: ## Build the website locally from a container and serve it
4246
@echo "Serving via container. Browse to http://localhost:4000"
43-
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) --entrypoint hugo $(HOMEPAGE_CONTAINER) server -p 4000 $(HUGO_SERVER_OPTS)
47+
podman run $(PODMAN_OPTS) -v $(PWD):/site:$(ATTRS) $(HOMEPAGE_CONTAINER) -c "hugo && node utils/generate-md.js && hugo server -p 4000 $(HUGO_SERVER_OPTS)"
48+
4449

4550
.PHONY: htmltest
4651
htmltest: build ## Runs htmltest against the site to find broken links

config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ mediaTypes:
4545
outputFormats:
4646
patterns:
4747
mediatype: application/json
48+
llmstxt:
49+
mediatype: text/plain
50+
baseName: llms
51+
isPlainText: true
52+
notAlternative: true
4853

4954
menus:
5055
main:
@@ -56,3 +61,7 @@ sitemap:
5661
priority: 0.5
5762
filename: sitemap.xml
5863
enableRobotsTXT: true
64+
outputs:
65+
home:
66+
- html
67+
- llmstxt

layouts/index.llmstxt.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# {{ .Site.Title }}
2+
3+
> {{ .Site.Params.description }}
4+
5+
Important notes:
6+
7+
- Validated Patterns are built on OpenShift Container Platform (Kubernetes) and leverage GitOps principles using ArgoCD, Red Hat Advanced Cluster Management (RHACM), and Tekton
8+
- They are designed for IT architects, advanced developers, and system administrators familiar with Kubernetes and OpenShift
9+
- Patterns can be deployed using either the OpenShift-based Validated Patterns framework or the Ansible GitOps Framework (AGOF)
10+
- All patterns require an available OpenShift 4.12+ cluster with cluster-admin privileges, at least 8 CPU cores, 16GB RAM, and dynamic storage provisioning
11+
- Each pattern includes values files (values-global.yaml, values-hub.yaml) for customization and secrets management without committing sensitive data to git repositories
12+
- Markdown versions of all pages are available by appending index.md to any page URL. For example: https://validatedpatterns.io/learn/quickstart/index.md
13+
- Full documentation in a single file: https://validatedpatterns.io/llms-full.txt
14+
15+
## Learn
16+
{{ range where .Site.RegularPages "Section" "learn" }}
17+
- [{{ .Title }}]({{ .Permalink }}): {{ with .Params.summary }}{{ . }}{{ else }}{{ .Summary | plainify | truncate 150 }}{{ end }}
18+
{{- end }}
19+
20+
## Patterns
21+
{{ range .Site.Sections }}{{ if eq .Section "patterns" }}{{ range .Sections }}
22+
- [{{ .Title }}]({{ .Permalink }}): {{ with .Params.summary }}{{ . }}{{ else }}{{ .Summary | plainify | truncate 150 }}{{ end }}
23+
{{- end }}{{ end }}{{ end }}
24+
25+
## Contributing
26+
{{ range where .Site.RegularPages "Section" "contribute" }}
27+
- [{{ .Title }}]({{ .Permalink }}): {{ with .Params.summary }}{{ . }}{{ else }}{{ .Summary | plainify | truncate 150 }}{{ end }}
28+
{{- end }}

layouts/partials/page-actions.html

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
{{- $repo := .Site.Params.github_repo | default "validatedpatterns/docs" -}}
2-
{{- $branch := .Site.Params.github_branch | default "main" -}}
3-
{{- $filePath := "" -}}
4-
{{- $rawUrl := "" -}}
5-
{{- $sourceLabel := "View source" -}}
6-
{{- if .File -}}
7-
{{- $filePath = .File.Path -}}
8-
{{- $rawUrl = printf "https://raw.githubusercontent.com/%s/%s/content/%s" $repo $branch $filePath -}}
9-
{{- if strings.HasSuffix $filePath ".md" -}}
10-
{{- $sourceLabel = "View as Markdown" -}}
11-
{{- end -}}
12-
{{- end -}}
1+
{{- $mdUrl := printf "%sindex.md" .Permalink -}}
132

143
<div class="page-actions" data-permalink="{{ .Permalink }}">
154
<button type="button" class="page-actions__button" data-action="copy-page" aria-label="Copy page content">
@@ -25,21 +14,19 @@
2514
<i class="fas fa-link" aria-hidden="true"></i> Copy link
2615
</button>
2716
</li>
28-
{{- if $rawUrl }}
2917
<li role="menuitem">
30-
<a href="{{ $rawUrl }}" target="_blank" rel="noopener">
31-
<i class="fab fa-markdown" aria-hidden="true"></i> {{ $sourceLabel }}
18+
<a href="{{ $mdUrl }}" target="_blank" rel="noopener">
19+
<i class="fab fa-markdown" aria-hidden="true"></i> View as Markdown
3220
</a>
3321
</li>
34-
{{- end }}
3522
<li class="page-actions__divider" role="separator"></li>
3623
<li role="menuitem">
37-
<a href="https://claude.ai/new?q={{ printf "Read and summarize this documentation page: %s" .Permalink | urlquery }}" target="_blank" rel="noopener">
24+
<a href="https://claude.ai/new?q={{ printf "Read this page from the Validated Patterns docs: %sindex.md and answer questions about the content." .Permalink | urlquery }}" target="_blank" rel="noopener">
3825
<i class="fas fa-robot" aria-hidden="true"></i> Open in Claude
3926
</a>
4027
</li>
4128
<li role="menuitem">
42-
<a href="https://chatgpt.com/?q={{ printf "Read and summarize this documentation page: %s" .Permalink | urlquery }}" target="_blank" rel="noopener">
29+
<a href="https://chatgpt.com/?q={{ printf "Read this page from the Validated Patterns docs: %sindex.md and answer questions about the content." .Permalink | urlquery }}" target="_blank" rel="noopener">
4330
<i class="fas fa-comment-dots" aria-hidden="true"></i> Open in ChatGPT
4431
</a>
4532
</li>

static/js/page-actions.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,20 @@
8888
}
8989

9090
function copyPageContent(triggerEl) {
91-
var content = document.querySelector(".pf-c-content");
92-
if (!content) return;
93-
94-
var text = content.innerText || content.textContent;
95-
copyToClipboard(text, triggerEl);
91+
var mdUrl = window.location.href.replace(/\/?$/, "/") + "index.md";
92+
fetch(mdUrl)
93+
.then(function (res) {
94+
if (!res.ok) throw new Error("not found");
95+
return res.text();
96+
})
97+
.then(function (text) {
98+
copyToClipboard(text, triggerEl);
99+
})
100+
.catch(function () {
101+
var content = document.querySelector(".pf-c-content");
102+
if (!content) return;
103+
copyToClipboard(content.innerText || content.textContent, triggerEl);
104+
});
96105
}
97106

98107
function copyToClipboard(text, triggerEl) {

static/llms.txt

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)