Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting 404 for all links on Netlify #26

Closed
ShannaSeigel opened this issue Nov 8, 2020 · 7 comments
Closed

Getting 404 for all links on Netlify #26

ShannaSeigel opened this issue Nov 8, 2020 · 7 comments

Comments

@ShannaSeigel
Copy link

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
Copy link
Owner

maximevaillancourt commented Nov 8, 2020 via email

@maximevaillancourt
Copy link
Owner

maximevaillancourt commented Nov 8, 2020

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
Copy link
Author

ShannaSeigel commented Nov 8, 2020

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
Copy link
Owner

maximevaillancourt commented Nov 8, 2020

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).

  • Double-bracket syntax using note title: Here's a link to the note about cats: [[A note about cats]]
  • Double-bracket syntax using note filename without extension: Here's a link to the note about cats: [[cats]]

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
Copy link
Owner

I pushed a commit to show how we could fix the link syntax for a few links: ShannaSeigel@bd2321b

Feel free to take inspiration from this commit!

@ShannaSeigel
Copy link
Author

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
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants