mirror of
				https://github.com/imfing/hextra.git
				synced 2025-10-30 23:10:14 -04:00 
			
		
		
		
	 a44de285b2
			
		
	
	a44de285b2
	
	
	
		
			
			* Adapted theme's layout to [Hugo v0.146.0](https://gohugo.io/templates/new-templatesystem-overview/) * Bumped minimal Hugo version to v0.146.0
		
			
				
	
	
		
			22 lines
		
	
	
		
			725 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			725 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{/* This utility is used to get the file path from absolute, relative path or URL. */}}
 | |
| 
 | |
| {{- $path := .path -}}
 | |
| {{- $page := .page -}}
 | |
| 
 | |
| {{- $isLocal := not (urls.Parse $path).Scheme -}}
 | |
| {{- $isPage := and (eq $page.Kind "page") (not $page.BundleType) -}}
 | |
| {{- $startsWithSlash := hasPrefix $path "/" -}}
 | |
| {{- $startsWithRelative := hasPrefix $path "../" -}}
 | |
| 
 | |
| {{- if and $path $isLocal -}}
 | |
|   {{- if $startsWithSlash -}}
 | |
|     {{/* File under static directory */}}
 | |
|     {{- $path = (relURL (strings.TrimPrefix "/" $path)) -}}
 | |
|   {{- else if and $isPage (not $startsWithRelative) -}}
 | |
|     {{/* File is a sibling to the individual page file */}}
 | |
|     {{ $path = (printf "../%s" $path) }}
 | |
|   {{- end -}}
 | |
| {{- end -}}
 | |
| 
 | |
| {{- return $path -}}
 |