| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | --- | 
					
						
							| 
									
										
										
										
											2014-05-29 18:42:05 -04:00
										 |  |  | date: 2014-05-26 | 
					
						
							|  |  |  | linktitle: Usage | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | menu: | 
					
						
							|  |  |  |   main: | 
					
						
							| 
									
										
										
										
											2014-05-29 18:42:05 -04:00
										 |  |  |     parent: taxonomy | 
					
						
							|  |  |  | next: /taxonomies/displaying | 
					
						
							|  |  |  | prev: /taxonomies/overview | 
					
						
							|  |  |  | title: Using Taxonomies | 
					
						
							|  |  |  | weight: 15 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Defining taxonomies for a site
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-07 17:52:58 -06:00
										 |  |  | Taxonomies must be defined in the site configuration before they can be | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | used throughout the site. You need to provide both the plural and | 
					
						
							|  |  |  | singular labels for each taxonomy. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-23 21:34:13 -04:00
										 |  |  | Here is an example configuration in YAML that specifies three taxonomies | 
					
						
							|  |  |  | (the default two, plus `series`). | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | Notice the format is **singular key** : *plural value*.  | 
					
						
							|  |  |  | ### config.yaml
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     --- | 
					
						
							| 
									
										
										
										
											2014-06-21 17:51:14 +02:00
										 |  |  |     Taxonomies: | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |         tag: "tags" | 
					
						
							|  |  |  |         category: "categories" | 
					
						
							|  |  |  |         series: "series" | 
					
						
							|  |  |  |     --- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ## Assigning taxonomy values to content
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Once an taxonomy is defined at the site level, any piece of content | 
					
						
							|  |  |  | can be assigned to it regardless of content type or section. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Assigning content to an taxonomy is done in the front matter. | 
					
						
							|  |  |  | Simply create a variable with the *plural* name of the taxonomy | 
					
						
							|  |  |  | and assign all terms you want to apply to this content. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **taxonomy values are case insensitive** | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-07 17:52:58 -06:00
										 |  |  | ### Front Matter Example (in TOML)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     +++ | 
					
						
							|  |  |  |     title = "Hugo: A fast and flexible static site generator" | 
					
						
							|  |  |  |     tags = [ "Development", "Go", "fast", "Blogging" ] | 
					
						
							|  |  |  |     categories = [ "Development" ] | 
					
						
							|  |  |  |     series = [ "Go Web Dev" ] | 
					
						
							|  |  |  |     slug = "hugo" | 
					
						
							|  |  |  |     project_url = "http://github.com/spf13/hugo" | 
					
						
							|  |  |  |     +++ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  | ### Front Matter Example (in JSON)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         "title": "Hugo: A fast and flexible static site generator", | 
					
						
							|  |  |  |         "tags": [ | 
					
						
							|  |  |  |             "Development", | 
					
						
							|  |  |  |             "Go", | 
					
						
							|  |  |  |             "fast", | 
					
						
							|  |  |  |             "Blogging" | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         "categories" : [ | 
					
						
							|  |  |  |             "Development" | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         "series" : [ | 
					
						
							|  |  |  |             "Go Web Dev" | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         "slug": "hugo", | 
					
						
							|  |  |  |         "project_url": "http://github.com/spf13/hugo" | 
					
						
							|  |  |  |     } |