template: compare lastmod and publishdate
Most of blog posts have the lastmod displayed even if the publishdate is the same day, because lastmod comes from git information and has also hour, minutes and second, and publishdate is set manually, with only year, month and day. * Formats the date to compare them accurately, with datFormat function. * Styles a little bit the blockquote tag. * Spaces evenly the post information blocks. * Closes #5 Co-Authored-by: Igor Milhit <igor@milhit.ch>pull/31/head
							parent
							
								
									4b492fa427
								
							
						
					
					
						commit
						7b43ee60e5
					
				| 
						 | 
					@ -34,4 +34,6 @@ dd {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					blockquote {
 | 
				
			||||||
 | 
					  font-style: italic;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.post-info {
 | 
					.post-info {
 | 
				
			||||||
  display: flex;
 | 
					  display: flex;
 | 
				
			||||||
 | 
					  justify-content: space-between;
 | 
				
			||||||
  flex-wrap: wrap;
 | 
					  flex-wrap: wrap;
 | 
				
			||||||
  padding: 0;
 | 
					  padding: 0;
 | 
				
			||||||
  margin-top: 0;
 | 
					  margin-top: 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,9 @@
 | 
				
			||||||
 | 
					{{ $LastmodFormatted := dateFormat "2006-01-02" (.Lastmod) }}
 | 
				
			||||||
 | 
					{{ $PublishdateFormatted := dateFormat "2006-01-02" (.PublishDate) }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<ul class="post-info">
 | 
					<ul class="post-info">
 | 
				
			||||||
  <li>Publié le : {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li>
 | 
					  <li>Publié le : {{ dateFormat "2006-01-02" (default .Date (.PublishDate)) }}</li>
 | 
				
			||||||
  {{ if (and (isset .Params "lastmod") (gt .Lastmod .PublishDate)) }}
 | 
					  {{ if (and (isset .Params "lastmod") (gt $LastmodFormatted $PublishdateFormatted)) }}
 | 
				
			||||||
    <li>Dernière mise à jour : {{ .Lastmod.Format "2006-01-02" }}</li>
 | 
					    <li>Dernière mise à jour : {{ .Lastmod.Format "2006-01-02" }}</li>
 | 
				
			||||||
  {{ end }}
 | 
					  {{ end }}
 | 
				
			||||||
  {{ with .Params.categories }}
 | 
					  {{ with .Params.categories }}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue