diff --git a/qdrant-landing/config.toml b/qdrant-landing/config.toml index f513c0a9c..c379aceb0 100644 --- a/qdrant-landing/config.toml +++ b/qdrant-landing/config.toml @@ -116,6 +116,20 @@ disableKinds = ["taxonomy", "term"] environment = '{production}' path = '{**.skip,**.skip/*}' +[mediaTypes."text/markdown"] + suffixes = ["md"] + +[outputFormats.Markdown] + mediaType = "text/markdown" + isPlainText = true + isHTML = false + rel = "alternate" + +[outputs] + page = ["HTML", "Markdown"] + section = ["HTML", "RSS", "Markdown"] + home = ["HTML", "RSS"] + [services] [services.googleAnalytics] id = 'G-NZYW2651NE' diff --git a/qdrant-landing/layouts/_default/list.markdown.md b/qdrant-landing/layouts/_default/list.markdown.md new file mode 100644 index 000000000..f2cb42028 --- /dev/null +++ b/qdrant-landing/layouts/_default/list.markdown.md @@ -0,0 +1,8 @@ +# {{ .Title }} + +{{- $content := .RenderShortcodes -}} +{{- /* Rewrite internal absolute links: ](/path/to/page/) → ](/path/to/page/index.md) */}} +{{- $content = replaceRE `\]\((/[^):]*/)` `](${1}index.md` $content -}} +{{- /* Rewrite internal relative links: ](../page/) or (./page/) → same with index.md */}} +{{- $content = replaceRE `\]\((\.\.?/[^):]*/)` `](${1}index.md` $content -}} +{{ $content }} \ No newline at end of file diff --git a/qdrant-landing/layouts/_default/single.markdown.md b/qdrant-landing/layouts/_default/single.markdown.md new file mode 100644 index 000000000..f2cb42028 --- /dev/null +++ b/qdrant-landing/layouts/_default/single.markdown.md @@ -0,0 +1,8 @@ +# {{ .Title }} + +{{- $content := .RenderShortcodes -}} +{{- /* Rewrite internal absolute links: ](/path/to/page/) → ](/path/to/page/index.md) */}} +{{- $content = replaceRE `\]\((/[^):]*/)` `](${1}index.md` $content -}} +{{- /* Rewrite internal relative links: ](../page/) or (./page/) → same with index.md */}} +{{- $content = replaceRE `\]\((\.\.?/[^):]*/)` `](${1}index.md` $content -}} +{{ $content }} \ No newline at end of file diff --git a/qdrant-landing/layouts/shortcodes/code-snippet.markdown.md b/qdrant-landing/layouts/shortcodes/code-snippet.markdown.md new file mode 100644 index 000000000..0fc141117 --- /dev/null +++ b/qdrant-landing/layouts/shortcodes/code-snippet.markdown.md @@ -0,0 +1,49 @@ +{{- $path := .Get "path" -}} +{{- $order := .Get "order" -}} +{{- $block := .Get "block" -}} + +{{- if $order -}} + {{- $order = split $order " " -}} +{{- else -}} + {{- $order = slice -}} + {{- $currentPath := $path -}} + {{- $currentPathParts := split $currentPath "/" -}} + {{- $numParts := len $currentPathParts -}} + {{- range seq $numParts -}} + {{- $index := sub $numParts . -}} + {{- $currentPath = delimit (first (add $index 1) $currentPathParts) "/" -}} + {{- $sectionPage := $.Site.GetPage "section" $currentPath -}} + {{- if and $sectionPage $sectionPage.Params.snippetsOrder -}} + {{- $order = $sectionPage.Params.snippetsOrder -}} + {{- break -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{- $files := dict -}} +{{- range $dir := slice (printf "content/%s" $path) (printf "content/%s/generated/%s" $path $block) -}} + {{- if not (fileExists $dir) -}} + {{- continue -}} + {{- end -}} + {{- range (readDir $dir) -}} + {{- if or (strings.HasPrefix .Name "_") (not (strings.HasSuffix .Name ".md")) -}} + {{- continue -}} + {{- end -}} + {{- $filePath := printf "%s/%s" $dir .Name -}} + {{- $content := readFile $filePath -}} + {{- $files = merge $files (dict (strings.TrimSuffix ".md" .Name) $content) -}} + {{- end -}} +{{- end -}} + +{{- range $order -}} + {{- $snippet := index $files . -}} + {{- if $snippet }} +{{ $snippet }} + {{- end -}} +{{- end -}} + +{{- range $name, $content := $files -}} + {{- if not (in $order $name) }} +{{ $content }} + {{- end -}} +{{- end -}} \ No newline at end of file diff --git a/qdrant-landing/layouts/shortcodes/include.markdown.md b/qdrant-landing/layouts/shortcodes/include.markdown.md new file mode 100644 index 000000000..923e61347 --- /dev/null +++ b/qdrant-landing/layouts/shortcodes/include.markdown.md @@ -0,0 +1 @@ +{{- readFile (.Get 0) -}} \ No newline at end of file