gethinode / hinode

A clean documentation and blog theme for your Hugo site based on Bootstrap 5
https://gethinode.com
MIT License
150 stars 54 forks source link

[BUG] Link to a page resource not working anymore #1255

Open giomf opened 1 month ago

giomf commented 1 month ago

Describe the bug

A link to a page ressoruce is not working anymore after updating from 24.x to 27.0. I know that 26.x introduced some changes regarding link handling. However, the documentation still says that it is possible to link to page ressources.

Unfortunately, I get this error when trying so:

ERROR partial [assets/link.html] - Cannot find page or asset: './aufnahmeantrag_v1.pdf' at 'foerderverein/index.md'
ERROR partial [assets/link.html] - Cannot find page or asset: './sepa-mandat.pdf' at 'foerderverein/index.md'
ERROR partial [assets/link.html] - Cannot find page or asset: './satzung_1.4.1.pdf' at 'foerderverein/index.md'
ERROR partial [assets/link.html] - Cannot find page or asset: './beitragsordnung.pdf' at 'foerderverein/index.md
Permissions  Size User Group Date Modified Name
.rw-r--r--  226Ki guif users 13 Feb 17:15  aufnahmeantrag_v1.pdf
.rw-r--r--   48Ki guif users 13 Feb 17:15  beitragsordnung.pdf
.rw-r--r--  2,4Ki guif users 22 Okt 12:49  index.md
.rw-r--r--   81Ki guif users 13 Feb 17:15  satzung_1.4.1.pdf
.rw-r--r--  230Ki guif users 13 Feb 17:15  sepa-mandat.pdf

How I create the link:

[Öffnen](./aufnahmeantrag_v1.pdf)

To reproduce

Steps to reproduce the behavior:

  1. Create a Page and create a link to page ressources
  2. Build
  3. See error

Expected behavior

It should still build and the links should be created.

Host environment

Please complete the following information where applicable.

Hugo environment

Copy the output of hugo env or npm run env here.

hugo v0.136.2-ad985550a4faff6bc40ce4c88b11215a9330a74e+extended linux/amd64 BuildDate=2024-10-17T14:30:05Z VendorInfo=gohugoio
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.23.2"
github.com/sass/libsass="3.6.6"
github.com/webmproject/libwebp="v1.3.2"

Additional context

Add any other context about the problem here.

markdumay commented 1 month ago

Thanks for sharing the detailed information. I've released a fix in v0.27.1. Feel free to reopen this issue if needed.

giomf commented 1 month ago

Thanks the described issue seems to be fixed. Unfortunately, I have to re-open the issue again.

The link handling is still broken. However, it now affects basic links.

I get the following error:

ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.presseportal.de/blaulicht/pm/82522/5885224' at 'einsaetze/2024/0009/index.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.ionos.de' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.ionos.de/terms-gtc/terms-privacy;' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.ionos.de/hilfe/datenschutz/allgemeine-informationen-zur-datenschutz-grundverordnung-dsgvo/auftragsverarbeitung' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.instart.com' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.instart.com/company/legal/privacy-policy' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/datenschutz-generator.de' at 'datenschutz.md'
ERROR partial [assets/link.html] - Cannot find page or asset: 'https:/www.presseportal.de/blaulicht/pm/82522/5877457' at 'einsaetze/2024/0007/index.md'

Here is one example how I create the links:

[Pressebericht](https://www.presseportal.de/blaulicht/pm/82522/5885224)

Edit: I dont know why, but I can not re-open this issue. Ping me if I should create another Issue

markdumay commented 1 month ago

I fixed an error cleaning the link's url: https://github.com/gethinode/hinode/pull/1269/files#diff-02697a4d5bc59d090e9862b2de6e38349ad55396d0f1625175974c0bcb7e5491

The following example works as expected on my machine now (both Hinode and template repo):

[Pressebericht](https://www.presseportal.de/blaulicht/pm/82522/5885224)

The fix has been released in v0.27.3.

giomf commented 1 month ago

Hey,

thanks for you effort. The Links are working again! But still have some problems left. Now email adresses are failing...

ERROR partial [assets/link.html] - Cannot find page or asset: 'mailto:xxxx@yyyy.zz' at 'kontakt.md'

I do not use any shortcode ore markdown syntax. Its just a email in a page.

markdumay commented 1 month ago

thanks for you effort. The Links are working again

Great!

Regarding the mailto issue, what is the exact input? The following input seems to render as expected:

[Mail](mailto:xxxx@yyyy.zz)
giomf commented 4 weeks ago

Sorry for beeing unclear.

The input is a simple email adress: xxxx@yyyy.zz it will be converted to the mailto form as it looks. At least that's what I interpret from the error message as I didn't specify the mailto in my input.

giomf commented 5 days ago

@markdumay Could you reproduce the issue? Im still not able to build the page.

markdumay commented 5 days ago

Have you tried my example? I don't think leaving the mailto: prefix is valid Markdown syntax...

[Mail](mailto:xxxx@yyyy.zz)
giomf commented 4 days ago

Hey,

no, not yet. But I think we're talking about different things. I don't use a mailto prefix. See here what im actually doing.

So basicly I just use an plain email address. I acutally dont want to use a named link here because I want that the users can still see the address.

markdumay commented 4 days ago

Got it, thanks for the clarification. I copied the example input to a test page. It does not give any build errors... I'm using the following gold mark configuration in markup.toml.

[goldmark]
    [goldmark.extensions]
        definitionList = true
        footnote = true
        linkify = true
        strikethrough = true
        table = true
        taskList = true
        typographer = true
    [goldmark.extensions.passthrough]
        enable = true
    [goldmark.extensions.passthrough.delimiters]
        block = [['\[', '\]'], ['$$', '$$']]
        inline = [['\(', '\)'], ['$', '$']]
    [goldmark.parser]
        autoHeadingID = true
        autoHeadingIDType = 'github'
        wrapStandAloneImageWithinParagraph = false
    [goldmark.parser.attribute]
        block = true
    [goldmark.renderer]
        hardWraps = false
        unsafe = false
        xhtml = false

My suggestions:

  1. Verify the goldmark configuration
  2. Use full markdown syntax for your links (e.g. [info@ff-eppendorf.de](mailto:info@ff-eppendorf.de)). This syntax would still show the address to the user.
  3. Use the default Hugo render hook for links (this would bypass Hinode's modifications)

If these suggestion don't help, I could clone a copy of your site to recreate your issues locally. Which branch should I use?

giomf commented 3 days ago

Thanks for the suggestions.

I have updated the goldmark config and also used the named link syntax. Unfortunalty without success. It seems that every link not starting with http(s):// are treated as page or asset.

Deactivating the Hinodes link handler seems odd. Also I dont know how to do it.

Yes, for sure you could have a look. Just take the master branch. But be aware that there are a lot of images and the repo is kind of big. Also im unexpiered with hugo. If you stumble accross some anit-pattern feel free to point them out to me.