Enhancement: Internal linking for Hugo sites in editing mode #677

Open
opened 2026-10-05 02:59:56 +02:00 by adam · 0 comments
Owner

Is your feature request related to a problem? Please describe.

I'm using FrontMatter to manage my blog built on static site generator Hugo. As per default Hugo configuration content markdown files located in <BLOG_ROOT>/content/posts. This directory is registered in Settings > Content folders and FM plugin sees them as posts.

For internal linking of posts I use following notation: [link to another post](/another-post). Once site is generated URI of the link is prefixed with baseURL configured in Hugo config.toml and full URL becomes <baseURL>/another-post (e.g. https://mynextbestrace.com/another-post). So far so good.

In editing mode, however, when I want to navigate to the linked post I'm getting a popup dialog saying that the linked file doesn't exist. This is because VSCode is looking for the file <BLOG_ROOT>/another-post.md, and not <BLOG_ROOT>/content/posts/another-post.md.

Describe the solution you'd like

In order to support navigation through internal links in editing mode we need to have a resolver which would "translate" internal link URI to the proper file name.

We could have a setting: internalLinkedFilePrefix = 'content/posts'.
Whenever we try to navigate the local link [link to another post](/another-post) plugin will "resolve" it to a proper file name by adding a value of internalLinkedFilePrefix as a prefix and will open the file content/posts/another-post.md.

Screenshot 2024-09-28 at 16 16 31
**Is your feature request related to a problem? Please describe.** I'm using FrontMatter to manage my blog built on static site generator Hugo. As per default Hugo configuration content markdown files located in _<BLOG_ROOT>/content/posts_. This directory is registered in _Settings > Content folders_ and FM plugin sees them as posts. For internal linking of posts I use following notation: `[link to another post](/another-post)`. Once site is generated URI of the link is prefixed with `baseURL` configured in Hugo _config.toml_ and full URL becomes `<baseURL>/another-post` (e.g. https://mynextbestrace.com/another-post). So far so good. In editing mode, however, when I want to navigate to the linked post I'm getting a popup dialog saying that the linked file doesn't exist. This is because VSCode is looking for the file _<BLOG_ROOT>/another-post.md_, and not _<BLOG_ROOT>/content/posts/another-post.md_. **Describe the solution you'd like** In order to support navigation through internal links in editing mode we need to have a resolver which would "translate" internal link URI to the proper file name. We could have a setting: _internalLinkedFilePrefix = 'content/posts'_. Whenever we try to navigate the local link `[link to another post](/another-post)` plugin will "resolve" it to a proper file name by adding a value of _internalLinkedFilePrefix_ as a prefix and will open the file _content/posts/another-post.md_. <img width="968" alt="Screenshot 2024-09-28 at 16 16 31" src="https://github.com/user-attachments/assets/fdc185b9-3f1b-46b7-8ad8-d8c66d108d4a"> <!-- github-sync-id:2557193696 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#677