Franklin.jl icon indicating copy to clipboard operation
Franklin.jl copied to clipboard

Links on page with fill not rendered by optimize

Open McSinyx opened this issue 3 years ago • 9 comments

This is a bit obscure: there's a page on my site where links are not rendered:

2021-03-11T22:34:24

Upon some investigations, I noticed that these lines are those causing the trouble:

* [{{fill title ...}}](...)
* ...

I also noticed that replace the unrendered links with the inline variant also solve the issue.

The issue occurs to me on both 0.10.30 and the latest 0.10.33.

McSinyx avatar Mar 11 '21 15:03 McSinyx

Thanks for reporting!

Ok yes so that's a bit tricky in terms of the order in which things are resolved. Basically {{...}} blocks are currently left "untouched" and passed to the HTML processor so the ordering is:

  1. markdown pass, most things are converted to HTML using MD -> HTML
  2. html pass, remaining {{...}} items are resolved

So in this case there's a conflict because it sees "shortcut links" (like [internship]()) but it can't find the definition because the {{...}} is not yet resolved (at least I think that's what's happening for you, I haven't yet looked at your repo).

An alternative which would work now and might suit you is to define page variables with the links and fill those so something like

+++
benchmark = "/foo/bar/benchmark/"
+++

Did you [see the benchmarks]({{benchmark}}) etc.

The difference here is that the MD pass will lead to <a href={{benchmark}}>see the benchmarks</a> and the html pass will then appropriately fill so you'll get <a href=/foo/bar/benchmark/>see the benchmarks</a>.

tlienart avatar Mar 11 '21 16:03 tlienart

Thanks, the suggested work-around indeed has the expected effect (the date is still incorrect though). I also forgot to mention that running serve also fix it (even the date), which agrees with your analogy, but it feels too hacky for automation :smile:

McSinyx avatar Mar 12 '21 02:03 McSinyx

What is the date issue?

tlienart avatar Mar 12 '21 07:03 tlienart

Affected pages also have the last modified date rendered as 0001-01-01. My guess would be it's has the same root cause.

McSinyx avatar Mar 12 '21 07:03 McSinyx

Hmm no that's another issue which I'm aware of but haven't fixed yet. Thanks for reporting!

Just for the specific issue here, is the workaround suggested above ok for you?

Note also that I'm working on a pretty significant refactoring of this (MD->HTML->HTML) pass which will likely remove the problem completely but I'm not sure exactly when I'll be done with it (it might take me a month or two).

Thanks again for the report!

tlienart avatar Mar 12 '21 07:03 tlienart

Yes, the workaround is OK for me. I'm looking forward to the refactored logic, although there's no hurry on my side.

McSinyx avatar Mar 12 '21 10:03 McSinyx

me too :joy:

tlienart avatar Mar 12 '21 10:03 tlienart

I was able to work around the date issue with git log, which is a win-win since the modification date is not preserved by git clone.

McSinyx avatar Nov 14 '21 08:11 McSinyx

ah awesome! thanks for letting me know :)

tlienart avatar Nov 14 '21 10:11 tlienart