mirror of
				https://github.com/ItsDrike/itsdrike.com.git
				synced 2025-11-03 19:56:36 +00:00 
			
		
		
		
	Fix content template
This commit is contained in:
		
							parent
							
								
									b444f03185
								
							
						
					
					
						commit
						7f84716ce8
					
				
					 1 changed files with 19 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -20,26 +20,27 @@
 | 
			
		|||
<div class="content mt-3">
 | 
			
		||||
    {{ if .TableOfContents }}
 | 
			
		||||
    <!-- Get the amount of headers using regex -->
 | 
			
		||||
    {{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
 | 
			
		||||
        <!-- We only need to show a table of contents if we have over 4 headers -->
 | 
			
		||||
        {{ if ge (len $headers) 4 }}
 | 
			
		||||
        <div class="float-lg-end ml-lg-3 mb-3 p-3">
 | 
			
		||||
            {{ .TableOfContents }}
 | 
			
		||||
        </div>
 | 
			
		||||
        {{ end }}
 | 
			
		||||
        {{ end }}
 | 
			
		||||
        {{ .Content }}
 | 
			
		||||
    {{ $headers := findRE "<h[1-6] ?.*?>(.|\n)*?</h[1-6]>" .Content }}
 | 
			
		||||
    <!-- We only need to show a table of contents if we have over 4 headers -->
 | 
			
		||||
    {{ if ge (len $headers) 4 }}
 | 
			
		||||
    <div class="float-lg-end ml-lg-3 mb-3 p-3">
 | 
			
		||||
        {{ .TableOfContents }}
 | 
			
		||||
    </div>
 | 
			
		||||
    {{ end }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
 | 
			
		||||
    {{ .Content }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        <div id="sources">
 | 
			
		||||
            {{ if .Params.Sources }}
 | 
			
		||||
            <h2>Sources</h2>
 | 
			
		||||
            <ul>
 | 
			
		||||
                {{ range $i, $e := .Params.Sources }}
 | 
			
		||||
                <li>{{ markdownify $e }}</li>
 | 
			
		||||
                {{ end }}
 | 
			
		||||
            </ul>
 | 
			
		||||
    <div id="sources">
 | 
			
		||||
        {{ if .Params.Sources }}
 | 
			
		||||
        <h2>Sources</h2>
 | 
			
		||||
        <ul>
 | 
			
		||||
            {{ range $i, $e := .Params.Sources }}
 | 
			
		||||
            <li>{{ markdownify $e }}</li>
 | 
			
		||||
            {{ end }}
 | 
			
		||||
        </div>
 | 
			
		||||
        </ul>
 | 
			
		||||
        {{ end }}
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
{{ end }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue