parent
							
								
									8c5cebef39
								
							
						
					
					
						commit
						527a2d1b3a
					
				| @ -1,3 +1,4 @@ | ||||
| title: "test" | ||||
| language: "en" | ||||
| domain: "test.io" | ||||
| https: true | ||||
| @ -1,7 +1,29 @@ | ||||
| {% macro meta(page) %} | ||||
| {# handle meta in templates #} | ||||
| 
 | ||||
| {% macro meta(page, site) %} | ||||
|     {% if (page.meta) %} | ||||
| 
 | ||||
|         {% set hasCannocial = false %} | ||||
| 
 | ||||
|         {% for key, content in page.meta %} | ||||
|             <meta name="{{ key }}" content="{{ content }}" /> | ||||
| 
 | ||||
|             {# check for index in robots if set page has canonical #} | ||||
|             {% if (key === 'robots' and content.indexOf('index') !== -1 and content.indexOf('noindex') === -1) %} | ||||
|                 {% set hasCannocial = true %} | ||||
|             {% endif %} | ||||
|         {% endfor %} | ||||
| 
 | ||||
|         {# check if page has canonical #} | ||||
|         {% if (hasCannocial) %} | ||||
|             {% set http = 'http' %} | ||||
| 
 | ||||
|             {% if (site.https) %} | ||||
|                 {% set http = site.https %} | ||||
|             {% endif %} | ||||
| 
 | ||||
|             <link href="{{ http }}://{{ site.domain }}{{ page.path }}" rel="canonical"> | ||||
|             <link rel="alternate" href="{{ http }}://{{ site.domain }}{{ page.path }}" hreflang="{{ site.language }}"> | ||||
|         {% endif %} | ||||
|     {% endif %} | ||||
| {% endmacro %} | ||||
| @ -1,4 +1,4 @@ | ||||
| import HappySite from './src/happySite.js' | ||||
| const HappySite = require('./src/happySite.js') | ||||
| 
 | ||||
| const happySite = new HappySite('./resources/site', './resources/views', ) | ||||
| const happySite = new HappySite('./resources/site', './resources/views', './public') | ||||
| happySite.run() | ||||
					Loading…
					
					
				
		Reference in new issue