From fb4629f82ee768bc52ccb90adf4e35176451e66a Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 1 Apr 2024 22:00:09 +0300 Subject: [PATCH] docs: move examples inline shortcode to a partial (#39829) * docs: move examples inline shortcode to a partial * Further tweaks --- site/content/docs/5.3/examples/_index.md | 66 ------------------------ site/layouts/_default/single.html | 1 + site/layouts/partials/examples/main.html | 63 ++++++++++++++++++++++ 3 files changed, 64 insertions(+), 66 deletions(-) create mode 100644 site/layouts/partials/examples/main.html diff --git a/site/content/docs/5.3/examples/_index.md b/site/content/docs/5.3/examples/_index.md index 0a08f68e6aba..75ea52010005 100644 --- a/site/content/docs/5.3/examples/_index.md +++ b/site/content/docs/5.3/examples/_index.md @@ -4,69 +4,3 @@ title: Examples description: Quickly get a project started with any of our examples ranging from using parts of the framework to custom components and layouts. aliases: "/examples/" --- - -{{< list-examples.inline >}} -{{ range $entry := $.Site.Data.examples -}} -
-

{{ $entry.category }}

-

{{ $entry.description }}

- {{ if eq $entry.category "RTL" -}} -
-

- RTL is still experimental and will evolve with feedback. Spotted something or have an improvement to suggest? -

-

Please open an issue.

-
- {{ end -}} - {{ range $i, $example := $entry.examples -}} - {{- $len := len $entry.examples -}} - {{ if (eq $i 0) }}{{ end -}} - {{ end -}} -
-{{ end -}} -{{< /list-examples.inline >}} diff --git a/site/layouts/_default/single.html b/site/layouts/_default/single.html index 427ee76c8d2a..d0d5e6b5d4fd 100644 --- a/site/layouts/_default/single.html +++ b/site/layouts/_default/single.html @@ -29,6 +29,7 @@

{{ .Title | markdownify }}

{{ .Content }} {{ if eq .Title "Examples" -}} + {{ partial "examples/main" . }} {{ partial "examples/bs-themes" . }} {{- end }} diff --git a/site/layouts/partials/examples/main.html b/site/layouts/partials/examples/main.html new file mode 100644 index 000000000000..902f964b4508 --- /dev/null +++ b/site/layouts/partials/examples/main.html @@ -0,0 +1,63 @@ +{{ range $entry := $.Site.Data.examples -}} +
+

{{ $entry.category }}

+

{{ $entry.description }}

+ {{ if eq $entry.category "RTL" -}} +
+

+ RTL is still experimental and will evolve with feedback. Spotted something or have an improvement to suggest? +

+

Please open an issue.

+
+ {{ end -}} + {{ range $i, $example := $entry.examples -}} + {{- $len := len $entry.examples -}} + {{ if (eq $i 0) }}
{{ end }} + {{ if $entry.external -}} +
+ +
+

+ + {{ $example.name }} + +

+

{{ $example.description }}

+

+ {{- $indexPath := default "index.html" $example.indexPath -}} + {{- $stackBlitzUrl := printf "%s%s%s" (urls.JoinPath "https://stackblitz.com/github/twbs" $example.url) "?file=" ($indexPath | urlquery) }} + + + Edit in StackBlitz + +

+
+
+ {{ else -}} + + {{- end }} + {{ if (eq (add $i 1) $len) }}
{{ end -}} + {{ end -}} +
+{{ end -}}