mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	docs: Improve Traversing Local Files
This commit is contained in:
		
				
					committed by
					
						
						digitalcraftsman
					
				
			
			
				
	
			
			
			
						parent
						
							b86a605bfb
						
					
				
				
					commit
					0d1e96701f
				
			
							
								
								
									
										13
									
								
								docs/layouts/shortcodes/directoryindex.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								docs/layouts/shortcodes/directoryindex.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
			
		||||
{{- $pathURL := .Get "pathURL" -}}
 | 
			
		||||
{{- $path := .Get "path" -}}
 | 
			
		||||
{{- $files := readDir $path -}}
 | 
			
		||||
<table>
 | 
			
		||||
    <th>Size in bytes</th>
 | 
			
		||||
    <th>Name</th>
 | 
			
		||||
{{- range $files }}
 | 
			
		||||
    <tr>
 | 
			
		||||
        <td>{{ .Size }}</td>
 | 
			
		||||
        <td><a href="{{ $pathURL }}{{ .Name | relURL }}"> {{ .Name }}</a></td>
 | 
			
		||||
    </tr>
 | 
			
		||||
{{- end }}
 | 
			
		||||
</table>
 | 
			
		||||
@@ -1,16 +0,0 @@
 | 
			
		||||
<table style="width=100%">
 | 
			
		||||
<th>Size in bytes</th>
 | 
			
		||||
<th>Name</th>
 | 
			
		||||
{{$dir := .Get "dir"}}
 | 
			
		||||
{{ $url := .Get "baseurl" }}
 | 
			
		||||
 | 
			
		||||
{{ $files := readDir $dir }}
 | 
			
		||||
    {{ range $files }}
 | 
			
		||||
			<tr>
 | 
			
		||||
                <td>{{.Size}}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <a href="{{$url}}{{.Name | urlize }}"> {{.Name}}</a>
 | 
			
		||||
                    </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
	 {{ end }}
 | 
			
		||||
</table>
 | 
			
		||||
							
								
								
									
										1
									
								
								docs/layouts/shortcodes/readfile.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								docs/layouts/shortcodes/readfile.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{{- .Get 0 | readFile -}}
 | 
			
		||||
		Reference in New Issue
	
	Block a user