| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | --- | 
					
						
							| 
									
										
										
										
											2014-05-29 18:42:05 -04:00
										 |  |  |  | aliases: | 
					
						
							|  |  |  |  | - /doc/templates/ | 
					
						
							|  |  |  |  | - /layout/templates/ | 
					
						
							| 
									
										
										
										
											2014-08-26 13:16:45 -04:00
										 |  |  |  | - /layout/overview/ | 
					
						
							| 
									
										
										
										
											2016-01-06 23:45:19 +01:00
										 |  |  |  | lastmod: 2015-05-22 | 
					
						
							| 
									
										
										
										
											2014-05-29 18:42:05 -04:00
										 |  |  |  | date: 2013-07-01 | 
					
						
							|  |  |  |  | linktitle: Overview | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | menu: | 
					
						
							|  |  |  |  |   main: | 
					
						
							| 
									
										
										
										
											2014-05-29 18:42:05 -04:00
										 |  |  |  |     parent: layout | 
					
						
							|  |  |  |  | next: /templates/go-templates | 
					
						
							|  |  |  |  | prev: /themes/creation | 
					
						
							|  |  |  |  | title: Hugo Templates | 
					
						
							|  |  |  |  | weight: 10 | 
					
						
							| 
									
										
										
										
											2015-05-22 20:46:09 +02:00
										 |  |  |  | toc: true | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | --- | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | Hugo uses the excellent Go html/template library for its template engine. | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | It is an extremely lightweight engine that provides a very small amount of | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | logic. In our experience it is just the right amount of logic to be able | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | to create a good static website. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | While Hugo has a number of different template roles, most complete | 
					
						
							|  |  |  |  | websites can be built using just a small number of template files. | 
					
						
							|  |  |  |  | Please don’t be afraid of the variety of different template roles. They | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | enable Hugo to build very complicated sites. Most sites will only | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | need to create a [/layouts/\_default/single.html](/templates/content/) & [/layouts/\_default/list.html](/templates/list/) | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | If you are new to Go's templates, the [Go Template Primer](/layout/go-templates/) | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | is a great place to start. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | If you are familiar with Go’s templates, Hugo provides some [additional | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | template functions](/templates/functions/) and [variables](/templates/variables/) you will want to be familiar | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | with. | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ## Primary Template roles
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | There are 3 primary kinds of templates that Hugo works with. | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [Single](/templates/content/)
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | Render a single piece of content | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [List](/templates/list/)
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | Page that list multiple pieces of content | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ### [Homepage](/templates/homepage/)
 | 
					
						
							|  |  |  |  | The homepage of your site | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ## Supporting Template Roles (optional)
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Hugo also has additional kinds of templates all of which are optional | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [Partial Templates](/templates/partials/)
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | Common page parts to be included in the above mentioned templates | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [Content Views](/templates/views/)
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | Different ways of rendering a (single) content type | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [Taxonomy Terms](/templates/terms/)
 | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | A list of the terms used for a specific taxonomy, e.g. a Tag cloud | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-20 23:10:15 +01:00
										 |  |  |  | ## Other Templates (generally unnecessary)
 | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | ### [RSS](/templates/rss/)
 | 
					
						
							|  |  |  |  | Used to render all rss documents | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ### [Sitemap](/templates/sitemap/)
 | 
					
						
							|  |  |  |  | Used to render the XML sitemap | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-27 19:17:09 -07:00
										 |  |  |  | ### [404](/templates/404/)
 | 
					
						
							| 
									
										
										
										
											2014-08-31 05:08:36 -06:00
										 |  |  |  | This template will create a 404.html page used when hosting on GitHub Pages | 
					
						
							| 
									
										
										
										
											2014-05-27 18:32:57 -04:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 |