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

Nested Liquid Output Markup and Tag Markup #780

Closed
Brixy opened this issue Jan 26, 2013 · 3 comments
Closed

Nested Liquid Output Markup and Tag Markup #780

Brixy opened this issue Jan 26, 2013 · 3 comments
Labels
frozen-due-to-age support This is a question about Jekyll's usage.

Comments

@Brixy
Copy link

Brixy commented Jan 26, 2013

Hi all,

I am trying to generate a Link from an external file.

{% post_url 2010-07-21-name-of-post %} works fine, but I am desperately trying to generate an internal link using this code:

{% post_url {{ myLink }} %}

myLink itself renders correctly. It is defined within the YAML meta data.

Is there a way to accomplish that?

Thank you!

@parkr
Copy link
Member

parkr commented Jan 27, 2013

As far as I can remember, it's not possible to embed Liquid like that. There have been a couple attempts to solve this problem by checking to see if the inputted string is in site.registers[:site] or something, but nothing has been brought into the project yet.

So at the moment, there's no way to accomplish that without a plugin.

@parkr parkr closed this as completed Jan 27, 2013
@mfcovington
Copy link

@Brixy I was also frustrated by this. In case it helps, here is my non-plugin work around:

{{ myLink | replace_first: '-', '/' | replace_first: '-', '/' | replace_first: '-', '/' | remove: '.md' }}

If you aren't using the default permalinks, you may need to adjust this. I use it with the 'pretty' permalinks and prepend it with the appropriate post category. I'm using it to add links based on ids of other posts in my YAML front matter; therefore, I made it work on strings w/ and w/o a '.md' at the end so I don't have to worry about which format I put.

@Brixy
Copy link
Author

Brixy commented Mar 9, 2013

@mfcovington Brilliant! Thank you very much for sharing your code!

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
frozen-due-to-age support This is a question about Jekyll's usage.
Projects
None yet
Development

No branches or pull requests

4 participants