2021-07-17 08:06:39 +03:00
# Obsidian Link Scrapper
2021-07-17 21:18:57 +03:00
This repository comes to you in two parts.
1. GitHub Action (scrapes links into a `.yml` file)
2. Hugo Partial (turns `.yml` file into graphs and tables)
2021-07-17 08:06:39 +03:00
2021-07-17 21:18:57 +03:00
## GitHub Action
GitHub action and binary to scrape [Obsidian ](http://obsidian.md/ ) vault for links and exposes them as a `.yml` file for easy consumption by [Hugo ](https://gohugo.io/ ).
### Example Usage (Binary)
2021-07-17 08:06:39 +03:00
Read Markdown from the `/content` folder and place the resulting `linkIndex.yaml` into `/data`
```shell
2021-07-17 18:39:53 +03:00
# Installation
go install github.com/jackyzha0/hugo-obsidian
# Run
2021-07-17 08:06:39 +03:00
hugo-obsidian -input=content -output=data
2021-07-17 18:39:53 +03:00
```
2021-07-17 21:18:57 +03:00
### Example Usage (GitHub Action)
2021-07-18 05:37:49 +03:00
Add 'Build Link Index' as a build step in your workflow file (e.g. `.github/workflows/deploy.yaml` )
```yaml
...
2021-07-17 21:18:57 +03:00
2021-07-18 05:37:49 +03:00
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Build Link Index
uses: jackyzha0/hugo-obsidian@v1.4
with:
input: content # input folder
output: data # output folder
...
```
2021-07-17 21:18:57 +03:00
## Hugo Partial
2021-07-18 05:37:49 +03:00
To then embed this information in your Hugo site, you can copy and use the provided partials in `/partials` . Graph provides a graph view of all nodes and links and Backlinks provides a list of pages that link to this page.
To start, create a `graphConfig.yaml` file in `/data` in your Hugo folder. This will be our main point of configuration for the graph partial.
2021-07-17 21:18:57 +03:00
2021-07-18 05:37:49 +03:00
Then, in one of your Hugo templates, do something like the following to render the graph.
```html
< div id = "graph-container" >
{{partial "graph_partial.html" .}}
< / div >
```
2021-07-17 21:18:57 +03:00
### Configuration
2021-07-18 05:37:49 +03:00
Example:
2021-07-17 21:18:57 +03:00
```yaml
enableLegend: false
enableDrag: true
enableZoom: false
base:
node: "#284b63"
activeNode: "#f28482"
inactiveNode: "#a8b3bd"
2021-07-18 05:37:49 +03:00
link: "#babdbf"
2021-07-17 21:18:57 +03:00
activeLink: "#5a7282"
paths:
- /toc: "#4388cc"
- /newsletters: "#e0b152"
- /posts: "#42c988"
```