diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..1b8ce89 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1,38 @@ +{{- $text_link := .Text -}} +{{- $sup := "" -}} + +{{ $_ := newScratch }} +{{- range $k, $v := .Page.Site.Data.sandpointsnamegraph -}} + {{ $_.Add "triads" $k }} +{{- end -}} + + + +{{ if strings.HasSuffix .Destination ".md" }} + {{ if in ($_.Get "triads") (index (split .Destination "/") 0) }} + + {{ $destNoSpaces := strings.Replace .Destination "%20" "-" }} + + + {{ if $.Page.Site.GetPage $destNoSpaces }} + {{ $session := $.Page.Site.GetPage $destNoSpaces }} + {{ .Page.Scratch.Add "links" (slice $session) }} + {{- index (split $destNoSpaces "/") 0 -}}⁄{{- $text_link -}} + {{ else }} + MD ENTRY DOES NOT EXIST: {{ .Destination }} + {{ end }} + {{ else }} + TRIAD DOES NOT EXIST: {{ .Destination }} + {{ end }} +{{ else }} + + {{ if strings.HasPrefix .Destination "http" }} + {{ $sup = "www" }} + + + {{ else if strings.HasPrefix .Destination "#" }} + {{ $sup = "§" }} + + {{ end }} + {{ $sup }}⁄LINK +{{ end }} diff --git a/layouts/taxonomy/list.html b/layouts/taxonomy/list.html new file mode 100644 index 0000000..a4dd4dd --- /dev/null +++ b/layouts/taxonomy/list.html @@ -0,0 +1,23 @@ +{{/* +ANY EDIT +(07.11.23) - Removed Author and Date from Keyword taxonomy list (/keywords/). Pages provided by reverse date +(01.11.24) - Pages in Keyword list sorted in alphabetic order (not .ByDate.Reverse, but .ByTitle) +*/}} +{{ define "keywords" }} + {{ $p := split (trim .RelPermalink "/") "/" }} + {{ if eq (len $p) 1 }} +
{{ index $p 0 }}⁄All
+ {{ range $taxonomyname, $taxonomy := .Site.Taxonomies }} + {{ if eq (index $p 0) $taxonomyname }} + {{ range $key, $value := $taxonomy }} + {{ $key }}({{ len (index (index $.Site.Taxonomies $taxonomyname) $key) }}) + {{ end }} + {{ end }} + {{ end }} + {{ else }} +
{{ index $p 0 }}⁄{{ index $p 1 }}
+ {{ range .Pages.ByTitle }} +
{{ .Title }}
+ {{ end }} + {{ end }} +{{ end }} diff --git a/readme.org b/readme.org new file mode 100644 index 0000000..852e30d --- /dev/null +++ b/readme.org @@ -0,0 +1,169 @@ +#+title: Readme + +* Introduction + +This repository is a guide for installing and using Sandpoints in tandem with Obsidian. + +Sandpoints is a free software + +* Installation Instructions +Follow the [[https://gohugo.io/getting-started/quick-start/][Hugo Quick Start guide]]. + +After installing Hugo, open a terminal and do: + +#+begin_src bash +hugo new site mysite +cd mysite +git init +git submodule add https://dev.sandpoints.org/Drawwell/SandpointsTheme themes/sandpoints +#+end_src + +The above will start a new blank side; start a git repository; and install the Sandpoints theme as a submodule. + + +Next we need to tell the project configuration to use the sandpoints theme: + +Open =hugo.toml= and add +#+begin_src toml +theme="sandpoints" +#+end_src + +Then, we can go again and start a local server to run and view the site: +#+begin_src toml +hugo server +#+end_src +** Project config: Sandpoints version + +At the moment Sandpoints works properly with Hugo version 0.113 --errors have to do with library references and endnote numbering for Print PDFs. + +Download [[https://github.com/gohugoio/hugo/releases/tag/v0.113.0][Hugo version 0.113 (GitHub)]]. +Place the Hugo executable (=hugo.exe=, or =hugo.bin=, etc.) on the root folder of your project, and rename to, for example, =hugo-113.exe=. + +To then run a local server or compile the site do: + +#+begin_src bash +hugo-113.exe server +#+end_src +or +#+begin_src bash +hugo-113.exe +#+end_src + + +* Setup Sandpoints project + +** Site config file +*** Enable keywords +Add keyword taxonomy to =hugo.toml= +and enable relative urls +#+begin_src TOML +# Relative URLS +relativeurls = true + +# Taxonomy: keyword = "keywords" +[taxonomies] +keyword = "keywords" +#+end_src +*** Setup metadata +#+begin_src TOML +[params] +# Project description +description = "Project description" +## sandpointsHome renders link to predefined home if page not in triad +sandpointsHome = "package/stc.md" +# Enable backlinks for content types +sandpointsMentionedIn = ["annex", "author", "section" ,"item", "thing", "person"] +# sandpointsGiteaUrl = "https://git.sandpoints.org/we/da-component.git" # used in layouts/partials/header.html to generate links in /Preview/ UI +sandpointsCatalogPrefix = "/library/" +sandpointsCatalogName = "custom-sandpoints-project-name" +#+end_src + +** Enable URLS + +Create =urls/_index.md= +Open the file and add +#+begin_src Markdown +--- +title: "List of Urls" +--- +#+end_src + +Now the site =/urls/= shows a list of internal, outgoing, and bibliographic, links, as well as backlinks. +** Prepare print directory + +Crate =print/_index.md=. +Open the file and add +#+begin_src Markdown +--- +title: "List of Print Items" +--- +#+end_src + + +* Create content + +Create a new entry with +#+begin_src toml +hugo new entry/entry.md +#+end_src + +This will be created according to [[#archetypes][archetypes]]. +* Archetypes +:PROPERTIES: +:CUSTOM_ID: archetypes +:ID: 8f382044-aeeb-4022-ac35-f7fc88d2a880 +:END: + +Project archetypes directory at [[file:archetypes/][/archetypes/]]. + +Theme archetypes directory at [[file:themes/sandpoints/archetypes/][/themes/sandpoints/archetypes/]]. +* Sandpoints-Obsidian workflow +** Setup Obsidian + +Open the project's =content/= directory as a Vault using Obsidian + +Go to settings and: ++ *DISABLE* Wiki links ++ Set New Link Format to *Absolute path in vault* +** Customize Sandpoints theme for Obsidian +By default Sandpoints recognizes internal links in the form of +#+begin_src Markdown +![Link label](type/filename) +#+end_src + +or + +#+begin_src Markdown +![](type/filename) +#+end_src + +In which case the link label is populated dynamically. + + +Using Obsidian with standard Markdown links (instead of Wiki-type links), internal links would be of the type + +#+begin_src Markdown +[Link label](type/filename.md) +#+end_src + +Moreover, Obsidian allows spaces in the filenames of notes (e.g. =my note.md=), and replaces space characters with =%20= (as in =my%20note.md=). + +*** Create override for render-link.html + +Copy =render-link= from theme/layouts + +[[file:themes/sandpoints/layouts/_default/_markup/render-link.html]] + +to the corresponding directory inside layouts, at the root of the project: + +[[file:layouts/_default/_markup/render-link.html]] + +This overrides the theme's =render-link= behavior. +*** Edit custom render-link.html + +1. Add clause to replace =%20= with =-= (dash). + +* Other Sandpoints theme edits +** Edit keyword view (layouts/taxonomy/list) +By default, =/keywords= lists keywords together by creation date, sorted by creation date. +This is edited in [[file:layouts/taxonomy/list.html][/layouts/taxonomy/list.html]] to remove the mention of the creation date, and sort entries alphabetically.