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

"Could not find document" when using "link" or "post_url" commands #91

Open
cmcnicholas opened this issue Sep 2, 2018 · 6 comments
Open

Comments

@cmcnicholas
Copy link

Is the plugin intended to work when using Jekyll functions to generate links? An example below:

{% link _articles/activities/activities.en.md %}

This produces:

Liquid Exception: Could not find document '_articles/activities/activities.en.md' in tag 'link'. Make sure the document exists and the path is correct. in D:/Development/alloy-help/_posts/2017-07-10-assets.md
jekyll 3.4.3 | Error:  Could not find document '_articles/activities/activities.en.md' in tag 'link'.

Just to give some insight to our structure we have a collection called articles and sub directories of content. This was working fine before introducing the plugin and I would like to find a way to use the existing functions link and post_url if possible rather than in-lining the permalink.

I can confirm the file exists as well as a _articles/activities/activities.es.md

@untra
Copy link
Owner

untra commented Sep 3, 2018

Heya @cmcnicholas 👋

{% link _articles/activities/activities.en.md %}

Okay, so when you build the site, Polyglot will fork itself N times, one for each language you're building for. In each thread, it will then find the respective files starting from the directory matching it's assigned language, eg. /en/_articles/activities/activities.en.md . So in order to find your pages you will need to organize your _articles like this: with the default_lang files in the base directory, and the other _articles under the respective lang folders, like es, zh, etc.

I hope this helps 👍 you can also point me to your repo as well, and I'll clone it down to help further.

Cheers,
Untra

@cmcnicholas
Copy link
Author

Excellent, thanks for the quick response I will give this a try

@untra
Copy link
Owner

untra commented Sep 17, 2018

@cmcnicholas Did you have any luck with this? Otherwise I will close this issue.

@cmcnicholas
Copy link
Author

Not yet pal, apologies for keeping the issue open been busy on some other products currently, I will try and make time this week and update the issue

@evolverine
Copy link

evolverine commented Jun 9, 2020

I'm having the same issue, but with pages instead of posts; and I have, indeed, tried the suggested organization of the _pages folder, but in _pages/pledge.md a link tag as such {% link _pages/about.md %} still throws a Liquid Exception, saying that it

Could not find document '_pages/about.md' in tag 'link'. Make sure the document exists and the path is correct. in _pages/pledge.md

Both _pages/about.md and _pages/ro/about.md exist, and they have the respective languages configured in the header (lang: en, lang: ro), plus the same permalink: /about.

@george-gca
Copy link
Contributor

george-gca commented Feb 24, 2024

@untra this issue is not happening, but there is a deprecation warning. I am using it like this:

file: _posts/en-us/2023-07-12-post-bibliography.md

check the [distill style post]({% post_url 2018-12-22-distill %})

and the file _posts/en-us/2018-12-22-distill.md exists with the frontmatter as:

---
title: a distill-style blog post
date: 2018-12-22

in my config I set:

languages: ["en-us", "pt-br"]
default_lang: "en-us"
exclude_from_localization: ["assets"]
lang_from_path: true

The warning is:

Deprecation: A call to '{% post_url 2018-12-22-distill %}' did not match a post using the new matching
method of checking name (path-date-slug) equality. Please make sure that you change this tag to
match the post's name exactly.

But the link works as expected.

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

No branches or pull requests

4 participants