Closed ndvanforeest closed 3 years ago
How does it fail? If you replace link://
with http://
, does it work?
Thanks for your answer. Your suggestion works when used for "real" addresses, like HTTP://google.com, but not for links to pages within my site. To be safe, I tested this, with the following string in my org file:
[[http://pages/Bio]]
and it expands to this in the HTML file:
This does not give a working link in my site, as expected. Now leaving out the HTTP:// in the org file, like so
[[../pages/Bio]]
gives as HTML:
So, for some reason links to pages in the org file get converted to an image.
Just to be sure, I let org mode convert my org file to HTML, but then things work right. So, something in the orgmode plugin for nikola goes wrong, but I have no clue what that can be.
It is not a big deal in the sense that I can always hard code the links of my side on github pages into the org files, but it annoys me that such a basic thing as cross linking between pages in one site does not seem to work..
Using a link like "../pages/Bio" is probably not always going to work correctly, remember that the same content may appear in more than once place in your site.
Try "/pages/Bio" instead (or whatever is appropriate)
On Fri, Oct 2, 2020 at 11:18 AM Nicky van Foreest notifications@github.com wrote:
Thanks for your answer. Your suggestion works when used for "real" addresses, like HTTP://google.com, but not for links to pages within my site. To be safe, I tested this, with the following string in my org file:
[[http://pages/Bio]]
and it expands to this in the HTML file:
This does not give a working link in my site, as expected. Now leaving out the HTTP:// in the org file, like so
[[../pages/Bio]]
gives as HTML:
[image: nil] http://pages/Bio
So, for some reason links to pages in the org file get converted to an image.
Just to be sure, I let org mode convert my org file to HTML, but then things work right. So, something in the orgmode plugin for nikola goes wrong, but I have no clue what that can be.
It is not a big deal in the sense that I can always hard code the links of my side on github pages into the org files, but it annoys me that such a basic thing as cross linking between pages in one site does not seem to work..
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/354#issuecomment-702760342, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAMK3JMZ75CTESCYBGJX3SIXOKBANCNFSM4SAM6EGQ .
Thanks. I tried all such variations, using the slug, with //, just one /, no /, anything that I could imagine. I am now at the point that I ll write a simple script to convert the http string to my GitHub pages site equivalent. It’s not elegant, pretty dumb in fact, but that I can get to work for sure.
On 2 Oct 2020, at 17:03, Roberto Alsina notifications@github.com wrote:
Using a link like "../pages/Bio" is probably not always going to work correctly, remember that the same content may appear in more than once place in your site.
Try "/pages/Bio" instead (or whatever is appropriate)
On Fri, Oct 2, 2020 at 11:18 AM Nicky van Foreest notifications@github.com wrote:
Thanks for your answer. Your suggestion works when used for "real" addresses, like HTTP://google.com, but not for links to pages within my site. To be safe, I tested this, with the following string in my org file:
[[http://pages/Bio]]
and it expands to this in the HTML file:
This does not give a working link in my site, as expected. Now leaving out the HTTP:// in the org file, like so
[[../pages/Bio]]
gives as HTML:
[image: nil] http://pages/Bio
So, for some reason links to pages in the org file get converted to an image.
Just to be sure, I let org mode convert my org file to HTML, but then things work right. So, something in the orgmode plugin for nikola goes wrong, but I have no clue what that can be.
It is not a big deal in the sense that I can always hard code the links of my side on github pages into the org files, but it annoys me that such a basic thing as cross linking between pages in one site does not seem to work..
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/354#issuecomment-702760342, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAAMK3JMZ75CTESCYBGJX3SIXOKBANCNFSM4SAM6EGQ .
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
It should never be necessary to run a shell script to fix a Nikola site. Perhaps you need a different syntax to convince orgmode to output a link. Replacing link:// happens at a very late stage of the build, all you need to have it in <a href="">
.
Based on this (and the official docs example seems to be broken, which is just A-W-E-S-O-M-E…), I wrote this
(org-link-set-parameters
"link"
:export (lambda (path desc backend)
(cond
((eq 'html backend)
(format "<a href=\"link:%s\">%s</a>"
path (or desc path)))))
)
@ndvanforeest, can you test with your site (in init.el
, requires rm -rf cache
to test)? If it works, I guess we could add it to the file.
It works! So as to prevent any misunderstanding, I copied your elisp expression into the init.el of the org mode plugin for nikola (so not into my general init.el). Then I use the following string in my org file to refer to the file pages/bio.org (i.e, the html generated version of it): [[link:/bio][boi]]
Many thanks. Would it be an idea to update the docs of the orgmode plugin? I am a recent org mode renegade (after using nuweb, noweb, pweave... for the past 20 years), and to me it comes as a surprise that nikola seems to need the keywords "link"; the orgmode documentation uses keywords like "file:" and so on, but not "link:".
On Sun, 4 Oct 2020 at 01:16, Chris Warrick notifications@github.com wrote:
Based on this https://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/ (and the official docs example https://orgmode.org/manual/Adding-Hyperlink-Types.html seems to be broken, which is just A-W-E-S-O-M-E…), I wrote this
(org-link-set-parameters
"link"
:export (lambda (path desc backend)
(cond ((eq 'html backend) (format "<a href=\"link:%s\">%s</a>" path (or desc path)))))
)
@ndvanforeest https://github.com/ndvanforeest, can you test with your site (in init.el, requires rm -rf cache to test)? If it works, I guess we could add it to the file.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/354#issuecomment-703176123, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM266LEQLLYGL7MYTNYOJ3SI6WGDANCNFSM4SAM6EGQ .
link://
is Nikola-specific. Many formats don’t care about the scheme and will just generate a link, no matter if it’s https
, gopher
, link
, or qwerty
. I created PR #356 with the fix.
Hi,
I suppose it must be very simple, but I can't find how to get links working in the orgmode plugin. For instance,
[[link://slug/index][home]]
seems most reasonable to me, but any variant I try doesn't work. Any idea?