Jacky Zhao
2022-02-16 f192f9a23df34d30e223e20ab5e8cb8210a7dfe9
fix #54: root all image urls
1 files added
2 files modified
13 ■■■■■ changed files
content/notes/hosting.md 2 ●●● patch | view | raw | blame | history
layouts/_default/_markup/render-image.html 8 ●●●●● patch | view | raw | blame | history
layouts/partials/popover.html 3 ●●●●● patch | view | raw | blame | history
content/notes/hosting.md
@@ -10,7 +10,7 @@
### Enable GitHub Actions
By default, GitHub disables workflows from running automatically on Forked Repostories. Head to the 'Actions' tab of your forked repository and Enable Workflows to setup deploying your Quartz site!
![Enable GitHub Actions](/notes/images/github-actions.png)*Enable GitHub Actions*
![Enable GitHub Actions](notes/images/github-actions.png)*Enable GitHub Actions*
### Enable GitHub Pages
layouts/_default/_markup/render-image.html
New 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 -}}
layouts/partials/popover.html
@@ -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) {