Skip to content

Commit

Permalink
llms.txt: all links at the same level
Browse files Browse the repository at this point in the history
  • Loading branch information
flovntp committed Jan 9, 2025
1 parent c38b5ff commit 4f32e2b
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions themes/psh-docs/layouts/partials/llms/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,33 @@
{{- $sectionKeys := .sections -}}
{{- $sectionId := printf "section-%s-sidebar-id" .Context.Title | urlize -}}
{{- $sectionId = replace $sectionId "." "" -}}
{{- $isCurrentSection := false -}}
{{- $currentSection := .Context.Section -}}
{{- if in $sectionKeys $currentSection -}}
{{- $pageName := index ( split .Context.RelPermalink "/" ) 2 -}}
{{- $currentSection = replace $pageName ".html" "" -}}
{{- end -}}
{{- $currentPage := .CurrentPage -}}
{{- with $currentPage.File -}}
{{- if or ( hasPrefix . $currentSection ) ( hasPrefix ( replace . "get-started/" "") $currentSection ) ( hasPrefix ( replace . "guides/" "") $currentSection ) ( hasPrefix ( replace . "learn/" "") $currentSection ) ( hasPrefix ( replace . "start/" "") $currentSection ) -}}
{{- $isCurrentSection = true -}}
{{- end -}}
{{- end -}}
{{- $getStartedAttribute := "" -}}
{{- if ne $currentSection "other" -}}
{{- .Page -}}
{{- $itemTitle := .Context.Title | .Context.Page.RenderString }}
{{- if ne $itemTitle "" }}
- [{{ $itemTitle }}]({{ $upsunDocUrl }}{{ .Context.RelPermalink }})
- [{{ $itemTitle }}]({{ $upsunDocUrl }}{{ .Context.RelPermalink }})
{{- range .Context.Pages -}}
{{- $itemTitle = .Title | .Page.RenderString -}}
{{- $itemId := printf "%s-sidebar-id" ( replace ($itemTitle | urlize) "." "" ) -}}
{{- $levelTwoPages := .Pages -}}
{{- if or (in $levelTwoPages $currentPage ) ( eq $currentPage . ) -}}
{{- $isCurrentSection = true -}}
{{- else -}}
{{- $isCurrentSection = false -}}
{{- end -}}
{{- if not ( .Params.sidebarIgnore ) -}}
{{- with .Params.sectionBefore }}
- {{ . }}
- {{ . -}}
{{- end }}
- [{{ $itemTitle }}]({{ $upsunDocUrl }}{{ .RelPermalink }}){{ if ne .Description "" }}: {{ .Description | replaceRE `\{\{[%\|\<]?\ *vendor\/name\ *[\%|\>]?\}\}` "Upsun" }}{{- end -}}
- [{{ $itemTitle }}]({{ $upsunDocUrl }}{{ .RelPermalink }}){{- if ne .Description "" }}: {{ .Description | replaceRE `\{\{[%\|\<]?\ *vendor\/name\ *[\%|\>]?\}\}` "Upsun" -}}{{- end -}}
{{- if eq .Kind "section" -}}
{{- range $levelTwoPages -}}
{{- if not ( .Params.sidebarIgnore ) }}
- [{{- if isset .Params "sidebartitle" -}}{{ .Params.sidebarTitle | .RenderString -}}{{- else -}}{{ .Title | .RenderString -}}{{- end -}}]({{ $upsunDocUrl }}{{ .RelPermalink }}){{ if ne .Description "" }}: {{ .Description | replaceRE `\{\{[%\|\<]?\ *vendor\/name\ *[\%|\>]?\}\}` "Upsun" }}{{ end -}}
{{ if not ( .Params.sidebarIgnore ) }}
- [{{- if isset .Params "sidebartitle" -}}{{ .Params.sidebarTitle | .RenderString -}}{{- else -}}{{ .Title | .RenderString -}}{{- end -}}]({{ $upsunDocUrl }}{{ .RelPermalink }}){{- if ne .Description "" }}: {{ .Description | replaceRE `\{\{[%\|\<]?\ *vendor\/name\ *[\%|\>]?\}\}` "Upsun" -}}{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down

0 comments on commit 4f32e2b

Please sign in to comment.