fix #54: root all image urls
This commit is contained in:
		
							
								
								
									
										8
									
								
								layouts/_default/_markup/render-image.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								layouts/_default/_markup/render-image.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
{{$src := .Destination | safeURL }}
 | 
			
		||||
{{$external := strings.HasPrefix $src "http" }}
 | 
			
		||||
{{- if $external -}}
 | 
			
		||||
<img src="{{ $src }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
 | 
			
		||||
{{- else -}}
 | 
			
		||||
{{$fixedUrl := (cond (hasPrefix $src "/") $src (print "/" $src)) | urlize}}
 | 
			
		||||
<img src="{{ $fixedUrl }}" alt="{{ .Text }}" {{ with .Title }} title="{{ . }}" {{ end }} />
 | 
			
		||||
{{- end -}}
 | 
			
		||||
@@ -11,9 +11,6 @@
 | 
			
		||||
    fetchData().then(({content}) => {
 | 
			
		||||
      const links = [...document.getElementsByClassName("internal-link")]
 | 
			
		||||
      links.forEach(li => {
 | 
			
		||||
        console.log(li.dataset.src.replace(baseUrl, ""))
 | 
			
		||||
        console.log(content[li.dataset.src.replace(baseUrl, "")])
 | 
			
		||||
        console.log(content)
 | 
			
		||||
        const linkDest = content[li.dataset.src.replace(baseUrl, "")]
 | 
			
		||||
        // const linkDest = content[li.dataset.src]
 | 
			
		||||
          if (linkDest) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user