maximevaillancourt / digital-garden-jekyll-template

Start your own digital garden using this Jekyll template 🌱
https://digital-garden-jekyll-template.netlify.app/
Other
961 stars 750 forks source link

Getting 404 for all links on Netlify #26

Closed ShannaSeigel closed 3 years ago

ShannaSeigel commented 3 years ago

Hi again, more questions!

I forked this repository, changed nothing, and then connected it to a site on netlify. I then added a few markdown notes and linked to them from the index page and the "your first note" page.

On the index, every link I click except "your first note" gives me a 404 error. If I go to "your first note" and mouse over any links I added I'm immediately prompted to download the markdown file.

No idea what I've messed up! Any thoughts?

Site: https://mv-dg.netlify.app/ Repo: https://github.com/ShannaSeigel/digital-garden-jekyll-template

maximevaillancourt commented 3 years ago

Nice! Almost there.

Try moving your Markdown files to the '_notes/' directory (instead of 'pubzk/'). 🙂

The reason why your browser tries to download the Markdown files is because they're in a directory that Jekyll (the static site generator used in the template) considers as "static files", so it tells the browser to download the files (instead of simply viewing them).

maximevaillancourt commented 3 years ago

As for linking to notes from other notes, you may use the double-bracket syntax (for example, using [[videos on how to zk]] in a Markdown file would generate an HTML link to /videos-on-how-to-zk, which should work since you have a file named videos-on-how-to-zk.md in the _notes/ directory).

ShannaSeigel commented 3 years ago

I was testing both the "_notes" folder and another since the first notes I tested weren't showing up. I'll try just using the notes directory. To make sure I understand, do I have to use the double brackets for links? By default I've been using [link text](filename.md) for all my links in case I ever use a platform that doesn't support [[ links.

That's the part that's been confusing to me. In the index.md file I have [videos-on-how-to-zk](../_notes/videos-on-how-to-zk.md) but that link comes backs with 404-not found. I'm working in Obsidian and it generates a relative link when I link to a note.

Edit: I just noticed in the syntax section it has {: .internal-link} after markdown style links. I missed that before.

maximevaillancourt commented 3 years ago

I was testing both the "_notes" folder and another since the first notes I tested weren't showing up. I'll try just using the notes directory.

There are a few things to understand before we discuss linking to notes.

All Markdown notes in the _notes/ directory must have a "front matter" section defined at the top of the files. As an example, look at the first 4 lines in this file:

---
title: Your first seed
image: /assets/image.jpg
---

This is what Jekyll considers as front matter.

Notes in the _notes/ directory that have valid front matter will be exposed on the final website at the /<note-filename> path. For example, if you have a note file in _notes/cats.md (which you do), you'll be able to access the note on the generated website at this relative address: /cats (so https://mv-dg.netlify.app/cats in your case).

Make sure all your Markdown notes have a front-matter section (with at least a title).


To make sure I understand, do I have to use the double brackets for links? By default I've been using link text for all my links in case I ever use a platform that doesn't support [[ links.

That's the part that's been confusing to me. In the index.md file I have videos-on-how-to-zk but that link comes backs with 404-not found. I'm working in Obsidian and it generates a relative link when I link to a note.

As for linking to other notes from a note, there are three ways to do so (in descending order of how easy they are to use).

Let's assume we have a file at _notes/cats.md with the following content:

---
title: "A note about cats"
---

This is a note about cats!

A) Double-bracket link syntax (Roam/wiki-style)

You may use the double-bracket syntax to link to another note by its title, or its filename without extension (as defined by this plugin).

This approach doesn't let you use a link label that's different than the note title or filename. The next two do.

B) Markdown link syntax

You may use an HTML anchor tag to link directly to a note, like this: [A link to the note about cats](/cats).

C) HTML anchor tag

You may use an HTML anchor tag to link directly to a note, like this: <a href="/cats">A link to the note about cats</a>.

maximevaillancourt commented 3 years ago

I pushed a commit to show how we could fix the link syntax for a few links: https://github.com/ShannaSeigel/digital-garden-jekyll-template/commit/bd2321b612bcec5113059e871ef8a2b40c960a21

Feel free to take inspiration from this commit!

ShannaSeigel commented 3 years ago

OK! Looks like we're getting there! And thank you for the examples in the commit.

I started reading about front matter recently for my notes and didn't consider that for these test pages. I added titles to a few notes and I'm able to navigate to them from page links and from the graph 😃

Thank you so much for taking the time to reply to all my questions with such detailed responses! I'm looking forward to doing some more playing around

maximevaillancourt commented 3 years ago

I'll close this as it's not an issue with the template itself, but feel free to reach out for help. 🙂