display parent and child topics on topic pages
This commit is contained in:
		
							parent
							
								
									32c9150232
								
							
						
					
					
						commit
						ee944b02a1
					
				
					 4 changed files with 61 additions and 9 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| # de.yaml 2020-06-19 | # de.yaml 2021-11-11 | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| about: | about: | ||||||
|  | @ -20,6 +20,9 @@ articles-in-section: | ||||||
| author: | author: | ||||||
|   other: Autor |   other: Autor | ||||||
| 
 | 
 | ||||||
|  | child-topics: | ||||||
|  |   other: Unterbegriffe | ||||||
|  | 
 | ||||||
| contact: | contact: | ||||||
|   other: Kontakt |   other: Kontakt | ||||||
| 
 | 
 | ||||||
|  | @ -41,6 +44,9 @@ next: | ||||||
| pages: | pages: | ||||||
|   other: Seiten |   other: Seiten | ||||||
| 
 | 
 | ||||||
|  | parent-topics: | ||||||
|  |   other: Oberbegriffe | ||||||
|  | 
 | ||||||
| posts: | posts: | ||||||
|   other: Artikel |   other: Artikel | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| # en.yaml 2020-05-10 | # en.yaml 2021-11-11 | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| about: | about: | ||||||
|  | @ -20,6 +20,9 @@ articles-in-section: | ||||||
| author: | author: | ||||||
|   other: Author |   other: Author | ||||||
| 
 | 
 | ||||||
|  | child-topics: | ||||||
|  |   other: Child Topics | ||||||
|  | 
 | ||||||
| contact: | contact: | ||||||
|   other: Contact |   other: Contact | ||||||
| 
 | 
 | ||||||
|  | @ -45,6 +48,9 @@ pages: | ||||||
| posts: | posts: | ||||||
|   other: Posts |   other: Posts | ||||||
| 
 | 
 | ||||||
|  | parent-topics: | ||||||
|  |   other: Parent Topics | ||||||
|  | 
 | ||||||
| prev: | prev: | ||||||
|   other: Previous |   other: Previous | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -28,8 +28,8 @@ | ||||||
|       </div> |       </div> | ||||||
|       <div class="card-body"> |       <div class="card-body"> | ||||||
|           {{ range . -}} |           {{ range . -}} | ||||||
|           {{ $page := $site.GetPage (printf "/topics/%s" .) }} |           {{- $page := $site.GetPage (printf "/topics/%s" .) -}} | ||||||
|           <span class="badge badge-pill badge-secondary"> |           <span class="badge badge-pill badge-secondary m-1"> | ||||||
|             <a href="{{ $page.Permalink }}">{{ $page.Title }}</a> |             <a href="{{ $page.Permalink }}">{{ $page.Title }}</a> | ||||||
|           </span> |           </span> | ||||||
|           {{- end }} |           {{- end }} | ||||||
|  |  | ||||||
|  | @ -2,19 +2,59 @@ | ||||||
| 
 | 
 | ||||||
| <div class="home"> | <div class="home"> | ||||||
| 
 | 
 | ||||||
|  |   {{- $site := .Site -}} | ||||||
|  |   {{- $parents := .Params.Topics -}} | ||||||
|  |   {{- $children := (where  | ||||||
|  |                       (where .Site.Pages "Section" "topics")  | ||||||
|  |                    "Params.topics" "intersect" (slice .Name))  -}} | ||||||
|  |   {{- $mainWidth := or (and $parents "col-md-8") "col-md-12" -}} | ||||||
|   <div class="row"> |   <div class="row"> | ||||||
|     <div class="col-md-12"> | 
 | ||||||
|  |     <div class="{{ $mainWidth }}"> | ||||||
|       <div class="card mt-3 mb-3"> |       <div class="card mt-3 mb-3"> | ||||||
|         <div class="card-body bg-light"> |         <div class="card-header"> | ||||||
|           <h2 class="card-text">{{i18n .Data.Singular}}: {{ .Title }}</h2> |           <h2 class="card-text">{{i18n .Data.Singular}}: {{ .Title }}</h2> | ||||||
|         </div> |         </div> | ||||||
|  |         <div class="card-body"> | ||||||
|           {{ with .Content -}} |           {{ with .Content -}} | ||||||
|         <div class="card-body"><p class="card-text">{{ . }}</p></div> |             <div class="card-text">{{ . }}</div> | ||||||
|  |           {{- end }} | ||||||
|  |           {{ with $children -}} | ||||||
|  |             <p class="card-text"> | ||||||
|  |             {{- i18n "child-topics" -}}: | ||||||
|  |             {{ range . -}} | ||||||
|  |               <span class="badge badge-pill badge-secondary mr-1"> | ||||||
|  |                 <a href="{{ .Permalink }}">{{ .Title }}</a> | ||||||
|  |               </span> | ||||||
|  |             {{- end }} | ||||||
|  |             </p> | ||||||
|           {{- end }} |           {{- end }} | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
| 
 | 
 | ||||||
|  |     {{ with $parents -}} | ||||||
|  |     <div class="col-md-4"> | ||||||
|  |       <div class="card mt-3"> | ||||||
|  |         <div class="card-header"> | ||||||
|  |           <h4 class="card-text">{{i18n "parent-topics"}}</h4> | ||||||
|  |         </div> | ||||||
|  |         <div class="card-body"> | ||||||
|  |           {{ range . -}} | ||||||
|  |             {{- $page := $site.GetPage (printf "/topics/%s" .) -}} | ||||||
|  |             <span class="badge badge-pill badge-secondary mr-1 mb-1"> | ||||||
|  |               <a href="{{ $page.Permalink }}" | ||||||
|  |                  class="text-decoration-none">{{ $page.Title }} | ||||||
|  |               </a> | ||||||
|  |             </span> | ||||||
|  |           {{- end }} | ||||||
|  |         </div> | ||||||
|  |       </div> | ||||||
|  |     </div> | ||||||
|  |     {{- end }} | ||||||
|  | 
 | ||||||
|  |   </div> | ||||||
|  | 
 | ||||||
|   <div class="row"> |   <div class="row"> | ||||||
|     {{ $paginator := .Paginate (.Data.Pages) }} |     {{ $paginator := .Paginate (.Data.Pages) }} | ||||||
|     {{ range $paginator.Pages }} |     {{ range $paginator.Pages }} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue