GithubHelp home page GithubHelp logo

jmn / obsblog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vinibaggio/obsblog-template

0.0 1.0 0.0 2.21 MB

Obsidian vault as a Hugo blog.

License: MIT License

Shell 20.71% HTML 67.36% CSS 11.93%

obsblog's Introduction

Obsidian to Hugo blog builder

T

Instructions to fork this repository

This repository contains my personal set up to build my Obsidian notes into a Hugo based blog. This will take 1 or 2 hours.

Fork this repo

Yes, fork this repo.

Prepare your Hugo blog

Either create a new hugo blog by following the instructions on their website: https://gohugo.io/getting-started/quick-start/ or import your hugo blog into hugoroot. Note that this script will overwrite some files that are needed to render links and images properly. Read more here why:

https://github.com/zoni/obsidian-export/#relative-links-with-hugo

Copy and modify the build.sh script

The build.example.sh script has a few variables you can modify, but the most important piece is to inject your Obsidian vault into the vault directory, and also configure the root of where the blog is located. Copy into build.sh and change the script accordingly.

Import your vault in the build script

Again, you will need to copy your vault into the vault directory. I recommend using the Obsidian Git plugin to back up your notes to a private Git repository. I will use Github as a platform but anywhere else will do. Once your Vault is exported into git, you can use git to clone / submodule into the vault directory.

I personally use submodules. I run:

rm -rf ./vault
git submodule add [email protected]/ORG/REPO ./vault

Then I modify the build script with:

git submodule init
git submodule update

Add frontmatter in your Obsidian posts

Hugo requires frontmatter for the blog posts to be rendered and tagged appropriately. I use the Templater plugin to put dates and other things automatically. I created the following template:

---
title: <% tp.file.title %>
date: <% tp.file.creation_date("YYYY-MM-DD") %>
description:
tags:
---

This template is inserted on top of the posts that I want to render into a blog.

Push this to a repository

Push all your changes to a git repo. I use Netlify to deploy the blog. I:

  1. Link my fork of this repo as a Netlify project
  2. Add a Deploy Key to my Obsidian vault's repo so Netlify can download it
  3. Trigger a deploy. Hopefully things will be super smooth!

Automatically deploying your blog on Obsidian updates

  1. Create a Build hook in your Netlify application. You will get an URL like so: `https://api.netlify.com/build_hooks/12345"
  2. Create a Github Action in your Obsidian repository. Create a file named .github/workflows/main.yml with the following contents:
name: Trigger Netlify Build
on: push
jobs:
  build:
    name: Request Netlify Webhook
    runs-on: ubuntu-latest
    steps:
      - name: Curl request
        run: curl -X POST -d {} https://api.netlify.com/build_hooks/12345

Boom! Whenever Obsidian Git pushes the changes, your blog will be updated right after.

obsblog's People

Contributors

jmn avatar vinibaggio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.