implement the Github edit link
This commit is contained in:
		
							parent
							
								
									6b05e21804
								
							
						
					
					
						commit
						15e14d207e
					
				|  | @ -34,4 +34,5 @@ footnotereturnlinkcontents = "↩" | ||||||
| 
 | 
 | ||||||
| [params] | [params] | ||||||
|     description = "A website built through Hugo and blogdown." |     description = "A website built through Hugo and blogdown." | ||||||
|  |     GithubEdit = "https://github.com/yihui/hugo-xmin/edit/feature/github-edit/exampleSite/content/" | ||||||
|     footer = "© [Yihui Xie](https://yihui.name) 2017 -- 2018 | [Github](https://github.com/yihui) | [Twitter](https://twitter.com/xieyihui)" |     footer = "© [Yihui Xie](https://yihui.name) 2017 -- 2018 | [Github](https://github.com/yihui) | [Twitter](https://twitter.com/xieyihui)" | ||||||
|  |  | ||||||
|  | @ -4,6 +4,17 @@ | ||||||
|   <hr/> |   <hr/> | ||||||
|   {{ . | markdownify }} |   {{ . | markdownify }} | ||||||
|   {{ end }} |   {{ end }} | ||||||
|  |   {{ if .File.Path }} | ||||||
|  |   {{ $RmdFile := (print .File.BaseFileName ".Rmd") }} | ||||||
|  |   {{ if (where (readDir (print "content/" .File.Dir)) "Name" $RmdFile) }} | ||||||
|  |     {{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }} | ||||||
|  |   {{ else }} | ||||||
|  |     {{ $.Scratch.Set "FilePath" .File.Path }} | ||||||
|  |   {{ end }} | ||||||
|  |   {{ with .Site.Params.GithubEdit}} | ||||||
|  |   | <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a> | ||||||
|  |   {{ end }} | ||||||
|  |   {{ end }} | ||||||
|   </footer> |   </footer> | ||||||
|   </body> |   </body> | ||||||
| </html> | </html> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue