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

Internal Links #458

Closed
straumer opened this issue Jan 19, 2014 · 9 comments
Closed

Internal Links #458

straumer opened this issue Jan 19, 2014 · 9 comments
Milestone

Comments

@straumer
Copy link

Hi. I can't seem to find it anywhere, so I'll ask. How can I make internal links in a post to my other posts easily?

@tommy351
Copy link
Member

There's no way so far.

@wzpan
Copy link
Member

wzpan commented Jan 22, 2014

I think the only possible way to do so so far is by customing your editor to make it search your local posts and display a menu for choice.

For instance, if you can read Chinese and are an emacs user, there is an article on how to easily insert images. I take that method. It's very handy.

Emacs总结(续)之YASnippet

Other capable editors may have similar workarounds.

@straumer
Copy link
Author

Okay. Thanks. It's not too hard to do it just manually either. The actual path isn't too complicated. But this is a feature worth considering sometime. Like in Pelican blog, you can just prepend this custom string in front: "|filename|/path/to/other-post". Generating takes care of getting the proper link. :)

@chenall
Copy link
Contributor

chenall commented Jan 23, 2014

in chinese
https://github.com/chenall/hexo-theme-chenall

{% iLink source:_posts/test.md %}

{% iLink id:456 %}

{% iLink tag:test %}

@rickcollette
Copy link

Is this something that is on the timeline for being added in? It would certainly be a welcome addition to this application.

@Xuanwo
Copy link
Contributor

Xuanwo commented Aug 7, 2014

If your problem solved, pleased the issues, spare more space for the new-comer, thanks.

@leesei
Copy link
Member

leesei commented Dec 9, 2014

I think we can add a tag to resolve slug (available in db.json, for _posts/hello-world.md it is "hello-world") to url.
If we can use [[ slug ]] this it is more like a wiki, otherwise {% post slug %} is also fine.

@kuanyui
Copy link

kuanyui commented Aug 23, 2015

For Emacs user, I wrote a function for Hexo to insert article's (static) link easily. Hope this would be useful for Emacs users.

@YJ2CS
Copy link

YJ2CS commented Dec 28, 2020

中文

在hxo更换了markdown渲染引擎后,你可以使用markdown-it的插件@gerhobbelt/markdown-it-wikilinks去实现这项功能,

[[Wiki Links]] -> <a href="./Wiki_Links.html">Wiki Links</a>

[[Wiki Links|here]] -> <a href="./Wiki_Links.html">here</a>

用类markdown语句来解释,就是[[Wiki Links]] -> [Wiki Links](...Wiki_Links.md)

除此之外,它还有一些允许自定义的选项,

具体见@gerhobbelt/markdown-it-wikilinks,

需要注意的是,你应该使用下列的命令安装这个包

npm i @gerhobbelt/markdown-it-wikilinks

关于如何配置markdown-it的插件,请见wiki

下面给出我的参考配置,在网站项目的根目录下,_config.yml中:

markdown:
  render:
..........
  plugins:
    - ..........
    - ..........
    - .........
    - name: '@gerhobbelt/markdown-it-wikilinks'
      options:
        # 将所有 wiki 链接渲染为绝对链接。
        # 默认: false
        # 这项要根据你前面对链接的渲染设置来更改
        makeAllLinksAbsolute: true
        # 绝对链接的前缀
        # default: /
#        baseURL: 'https://lamirs.vercel.app/'
        # url的后缀,
        # default: .html
        # [[title home]] -> [title_home](...title_home/index.html),注意后缀从默认的.html更改为 /index.html
        uriSuffix: '/index.html'

English

After hxo has replaced the markdown rendering engine, you can use the markdown-it plug-in @gerhobbelt/markdown-it-wikilinks to achieve this function.

Use markdown-like statements to explain, [[Wiki Links]] -> [Wiki Links](...Wiki_Links.md)

In addition, it also has some options that allow customization,

For details, see @gerhobbelt/markdown-it-wikilinks,

It should be noted that you should install this package using the following command

npm i @gerhobbelt/markdown-it-wikilinks

For how to configure the markdown-it plug-in, please see wiki

My reference configuration is given below, in the root directory of the website project, in _config.yml:

markdown:
  render:
..........
  plugins:
    - ..........
    - ..........
    - .........
    - name: '@gerhobbelt/markdown-it-wikilinks'
      options:
        # 将所有 wiki 链接渲染为绝对链接。
        # 默认: false
        # 这项要根据你前面对链接的渲染设置来更改
        makeAllLinksAbsolute: true
        # 绝对链接的前缀
        # default: /
#        baseURL: 'https://lamirs.vercel.app/'
        # url的后缀,
        # default: .html
        # [[title home]] -> [title_home](...title_home/index.html),注意后缀从默认的.html更改为 /index.html
        uriSuffix: '/index.html'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants