-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notes/export_org_roam_backlinks_with_gohugo/ #8
Comments
Thank you so much for this. Works like a charm :) |
Thanks for sharing this! I've been playing with getting it working on the wowchemy research group starter (as very much not a go person...). Although the heading comes up, I don't have any links showing (although shortcode relref links are present). I do get an ".File.BaseFileName on zero object. Wrap it in if or with: {{ with .File }}{{ .BaseFileName }}{{ end }}" error but I'm not sure that's relevant. Any chance you have any tips? (repo is at https://github.com/sjgknight/starter-hugo-research-group the 2 published posts have cross-links) |
Ah! Dumb error. If anyone is using the default wowchemy structure with a directory per-content item with index.md and whatever else in it, then obviously the filename isn't going to help much. Changing instances of BaseFileName to ContentBaseName fixes that easily enough. It does look for case matching (I guess in the original too). I think this can be fixed with 'lower' but I don't understand go scopes enough. Thanks! |
@sjgknight Glad you got it fixed!
Maybe you can try something like this: |
Export org-roam backlinks with Gohugo | Ben Mezger
tags Org-mode Emacs Org-roam Since Org-roam export backlinks on Hugo no longer works, I found a solution to handle backlinks in Hugo itself.$re := $ .File.BaseFileName }} {{ $backlinks := slice }} {{ range .Site.AllPages }} {{ if and (findRE $re .RawContent) (not (eq $re .File.BaseFileName)) }} {{ $backlinks = $backlinks | append . }} {{ end }} {{ end }}
The following Hugo partial template will add backlinks to a note if any.
{{
{{ if gt (len $backlinks) 0 }}
Links to this note
{{ range $backlinks }}- <a href="{{ .
https://seds.nl/notes/export_org_roam_backlinks_with_gohugo/
The text was updated successfully, but these errors were encountered: