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

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

Open
sandlex opened this issue Sep 30, 2024 · 0 comments
Open

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

sandlex opened this issue Sep 30, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sandlex
Copy link

sandlex commented Sep 30, 2024

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
@sandlex sandlex added the enhancement New feature or request label Sep 30, 2024
@estruyf estruyf added the help wanted Extra attention is needed label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants