Add option to output canonical URL (#240)
* Add option to output canonical URL Canonical links are handy to tell search engines which page is canonical amongst various permutations of URLs (e.g. https vs. http and www subdomain or not). Add an option to output one via the following pelicanconf.py setting: REL_CANONICAL = True
This commit is contained in:
		
							parent
							
								
									7150568800
								
							
						
					
					
						commit
						17565a6365
					
				
					 1 changed files with 13 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -115,6 +115,19 @@
 | 
			
		|||
    <meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
 | 
			
		||||
  {% endif %}
 | 
			
		||||
 | 
			
		||||
  {% if REL_CANONICAL %}
 | 
			
		||||
    {% if page %}
 | 
			
		||||
      <link rel="canonical" href="{{ SITEURL }}/{{ page.url }}">
 | 
			
		||||
    {% elif article %}
 | 
			
		||||
      <link rel="canonical" href="{{ SITEURL }}/{{ article.url }}">
 | 
			
		||||
    {% elif page_name == 'index' and not articles_previous_page %}
 | 
			
		||||
      <link rel="canonical" href="{{ SITEURL }}">
 | 
			
		||||
    {% elif author or category or tag or page_name == 'index' %}
 | 
			
		||||
      <link rel="canonical" href="{{ SITEURL }}/{{ articles_page.url }}">
 | 
			
		||||
    {% else %}
 | 
			
		||||
      <link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
 | 
			
		||||
    {% endif %}
 | 
			
		||||
  {% endif %}
 | 
			
		||||
  {% block meta %}
 | 
			
		||||
    <meta name="author" content="{{ AUTHOR }}" />
 | 
			
		||||
    <meta name="description" content="{{ SITEDESCRIPTION }}" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue