mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	Documentation update on Template Where Function for nil
This commit is contained in:
		
				
					committed by
					
						
						Bjørn Erik Pedersen
					
				
			
			
				
	
			
			
			
						parent
						
							29c9a40a8d
						
					
				
				
					commit
					d313bc78a4
				
			@@ -265,6 +265,22 @@ Following operators are now available
 | 
			
		||||
       {{ .Content }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
 | 
			
		||||
### Unset field
 | 
			
		||||
Filter only work for set fields. To check whether a field is set or exist, use operand `nil`.
 | 
			
		||||
 | 
			
		||||
This can be useful to filter a small amount of pages from a large pool. Instead of set field on all pages, you can set field on required pages only.
 | 
			
		||||
 | 
			
		||||
Only following operators are available for `nil`
 | 
			
		||||
 | 
			
		||||
- `=`, `==`, `eq`: True if the given field is not set.
 | 
			
		||||
- `!=`, `<>`, `ne`: True if the given field is set.
 | 
			
		||||
 | 
			
		||||
e.g.
 | 
			
		||||
 | 
			
		||||
    {{ range where .Data.Pages ".Params.specialpost" "!=" nil }}
 | 
			
		||||
       {{ .Content }}
 | 
			
		||||
    {{ end }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Math
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user