Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ The [example site](https://peteryuen.netlify.app/) shows the capabilities of `ob
- Set the path to the Obsisian vault using a `.vault_path` file or the `$VAULT` environment variable
- use `./local-run.sh` to run the site

# Local Testing (MacOS)

- Install zola from the instuctions on the site `https://www.getzola.org/documentation/getting-started/installation/`
- Run the following commands to install other needed dependencies `pip3 install python-slugify rtoml` (or use `conda` / `mamba`)
- Use `git clone https://github.com/ppeetteerrs/obsidian-zola` to clone the repo to somewhere other than inside the Obsidian vault folder
- Set the path to the Obsisian vault using a `.vault_path` file or the `$VAULT` environment variable
- use `./local-run-mac.sh` to run the site

# Features

**Disclaimer**
Expand Down
Binary file added bin/obsidian-export-mac
Binary file not shown.
Binary file modified icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions local-run-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Check for zola being installed
if ! command -v zola &>/dev/null; then
echo "zola could not be found please install it from https://www.getzola.org/documentation/getting-started/installation"
exit 1
fi

# Check for correct slugify package
PYTHON_ERROR=$(python3 slugify-test.py)

if [[ $PYTHON_ERROR != "test-string-one" ]]; then
if [[ $PYTHON_ERROR =~ "NameError" ]]; then
echo "It appears you have the wrong version of slugify installed, the required pip package is python-slugify"
else
echo "It appears you do not have slugify installed. Install it with 'pip install python-slugify'"
fi
exit 1
fi

# Check for rtoml package
PYTHON_ERROR=$(eval "python -c 'import rtoml'" 2>&1)

if [[ $PYTHON_ERROR =~ "ModuleNotFoundError" ]]; then
echo "It appears you do not have rtoml installed. Install it with 'pip install rtoml'"
exit 1
fi

# Check that the vault got set
if [[ -z "${VAULT}" ]]; then
if [[ -f ".vault_path" ]]; then
export VAULT=$(cat .vault_path)
else
echo "Path to the obsidian vault is not set, please set the path using in the $(.vault_path) file or $VAULT env variable"
exit 1
fi
fi

# Pull environment variables from the vault's netlify.toml when building (by generating env.sh to be sourced)
python3 env.py

# Set the site and repo url as local since locally built
export SITE_URL=local
export REPO_URL=local

# Remove previous build and sync Zola template contents
rm -rf build
rsync -a zola/ build
rsync -a content/ build/content
mv build/config-mac.toml build/config.toml

# Use obsidian-export to export markdown content from obsidian
mkdir -p build/content/docs build/__docs
if [ -z "$STRICT_LINE_BREAKS" ]; then
bin/obsidian-export-mac --frontmatter=never --hard-linebreaks --no-recursive-embeds $VAULT build/__docs
else
bin/obsidian-export-mac --frontmatter=never --no-recursive-embeds $VAULT build/__docs
fi

# Run conversion script
source env.sh && python3 convert.py && rm env.sh

# Serve Zola site
zola --root=build serve
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions slugify-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from slugify import slugify
print(slugify("Test String One"))
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class Settings:
"SLUGIFY": "y",
"HOME_GRAPH": "y",
"PAGE_GRAPH": "y",
"SUBSECTION_SYMBOL": "👉",
"SUBSECTION_SYMBOL": "",
"LOCAL_GRAPH": "",
"GRAPH_LINK_REPLACE": "",
"STRICT_LINE_BREAKS": "y",
Expand Down
Binary file added zola/.DS_Store
Binary file not shown.
39 changes: 39 additions & 0 deletions zola/config-mac.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
base_url = "___SITE_URL___"
title = "___SITE_TITLE___"

build_search_index = true
compile_sass = true
default_language = "en"
generate_feeds = true
minify_html = true
# render_emoji = true
taxonomies = []

[slugify]
paths = "off"

[search]
include_content = true
include_description = true
include_title = true

[markdown]
highlight_code = true

[extra]
home_graph = "___HOME_GRAPH___"
is_netlify = true
page_graph = "___PAGE_GRAPH___"
title_addition = "___SITE_TITLE_TAB___"

language_code = "en-US"
theme_color = "#fff"

ganalytics = "___GANALYTICS___"
timeformat = "%B %e, %Y"
timezone = "___TIMEZONE___"

[[extra.menu.social]]
name = "GitHub"
pre = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-github"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"></path></svg>'
url = "___REPO_URL___"
4 changes: 2 additions & 2 deletions zola/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ title = "___SITE_TITLE___"
build_search_index = true
compile_sass = true
default_language = "en"
generate_feed = true
generate_feeds = true
minify_html = true
render_emoji = true
# render_emoji = true
taxonomies = []

[slugify]
Expand Down
Binary file modified zola/static/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified zola/static/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified zola/static/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified zola/static/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified zola/static/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion zola/static/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ graph.once("afterDrawing", function () {
graph.moveTo({
position: {
x: 0,
y: -clientHeight / 3,
y: -clientHeight / 7,
},
scale: graph.getScale() * 1.2,
});
Expand Down
6 changes: 3 additions & 3 deletions zola/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ <h1 class="mt-0">{{ section.title | default(value="Modern Documentation Theme")

</div>

{% block footer %}
{{ macros_footer::footer() }}
{% endblock footer %}
<!-- {% block footer %} -->
<!-- {{ macros_footer::footer() }} -->
<!-- {% endblock footer %} -->

{% if config.extra.home_graph %}
{{ macros_graph::graph_js() }}
Expand Down
1 change: 1 addition & 0 deletions zola/templates/macros/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
{% macro favicons() %}
<meta name="theme-color" content="{{ config.extra.theme_color | default(value="#fff") }}">
<link rel="apple-touch-icon" sizes="180x180" href="{{ get_url(path="apple-touch-icon.png") | safe }}">
<!--TODO: need to change favicon-->
<link rel="icon" type="image/png" sizes="32x32" href="{{ get_url(path="favicon-32x32.png") | safe }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ get_url(path="favicon-16x16.png") | safe }}">
{% if not config.extra.is_netlify %}
Expand Down