From d674a46fdf01efeaff3fca23aa7241903c3b9a77 Mon Sep 17 00:00:00 2001 From: paoloredis Date: Thu, 29 May 2025 10:27:39 +0200 Subject: [PATCH 1/3] Add markdown output in preparation for llms.txt --- config.toml | 11 ++++++++++- layouts/_default/section.md | 4 ++++ layouts/_default/single.md | 4 ++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 layouts/_default/section.md create mode 100644 layouts/_default/single.md diff --git a/config.toml b/config.toml index 51d52fbd8e..9749a29a86 100644 --- a/config.toml +++ b/config.toml @@ -83,6 +83,15 @@ rdi_current_version = "1.8.0" # Everything below this are Site Params +# Add markdown output +[outputFormats] + [outputFormats.markdown] + name = "markdown" + baseName = "index" + mediaType = "text/markdown" + isPlainText = true + # Comment out if you don't want the "print entire section" link enabled. [outputs] -section = ["HTML", "RSS"] # print +section = ["HTML", "RSS", "Markdown"] # print +page = ["HTML", "Markdown"] \ No newline at end of file diff --git a/layouts/_default/section.md b/layouts/_default/section.md new file mode 100644 index 0000000000..cd2279c5a6 --- /dev/null +++ b/layouts/_default/section.md @@ -0,0 +1,4 @@ +# {{ .Title }} +{{ $content := .RawContent }} +{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} +{{ $content }} \ No newline at end of file diff --git a/layouts/_default/single.md b/layouts/_default/single.md new file mode 100644 index 0000000000..cd2279c5a6 --- /dev/null +++ b/layouts/_default/single.md @@ -0,0 +1,4 @@ +# {{ .Title }} +{{ $content := .RawContent }} +{{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} +{{ $content }} \ No newline at end of file From 9f1cdb29ba4a8848e00e447a85063358737f3504 Mon Sep 17 00:00:00 2001 From: paoloredis Date: Fri, 30 May 2025 09:10:26 +0200 Subject: [PATCH 2/3] Update basename used for markdown files to match format required by llms.txt --- config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.toml b/config.toml index 9749a29a86..09c76e82cb 100644 --- a/config.toml +++ b/config.toml @@ -87,7 +87,7 @@ rdi_current_version = "1.8.0" [outputFormats] [outputFormats.markdown] name = "markdown" - baseName = "index" + baseName = "index.html" mediaType = "text/markdown" isPlainText = true From 5f8e2113c64b6b8bdefef3ee4ea1643e23db763f Mon Sep 17 00:00:00 2001 From: paoloredis Date: Tue, 3 Jun 2025 14:32:18 +0200 Subject: [PATCH 3/3] Fix images links and remove all other shortcode usage --- layouts/_default/section.md | 10 ++++++++++ layouts/_default/single.md | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/layouts/_default/section.md b/layouts/_default/section.md index cd2279c5a6..8bb56db5e0 100644 --- a/layouts/_default/section.md +++ b/layouts/_default/section.md @@ -1,4 +1,14 @@ # {{ .Title }} {{ $content := .RawContent }} + +{{/* Fix relrefs */}} {{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} + +{{/* Fix images */}} +{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }} + +{{/* Remove all shortcodes */}} +{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }} +{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }} + {{ $content }} \ No newline at end of file diff --git a/layouts/_default/single.md b/layouts/_default/single.md index cd2279c5a6..8bb56db5e0 100644 --- a/layouts/_default/single.md +++ b/layouts/_default/single.md @@ -1,4 +1,14 @@ # {{ .Title }} {{ $content := .RawContent }} + +{{/* Fix relrefs */}} {{ $content := $content | replaceRE "\\{\\{< ?relref \"([^\"]+)\" ?>\\}\\}" "https://redis.io/docs/latest$1" }} + +{{/* Fix images */}} +{{ $content := $content | replaceRE "\\{\\{< ?image filename=\"([^\"]+)\" ?>\\}\\}" "![$1](https://redis.io/docs/latest$1)" }} + +{{/* Remove all shortcodes */}} +{{ $content := $content | replaceRE "\\{\\{% ?/?.*%\\}\\}" "" }} +{{ $content := $content | replaceRE "\\{\\{< ?/?.*>\\}\\}" "" }} + {{ $content }} \ No newline at end of file