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

Pagevariables not always available? #1081

Closed
kellertuer opened this issue Mar 6, 2024 · 8 comments
Closed

Pagevariables not always available? #1081

kellertuer opened this issue Mar 6, 2024 · 8 comments

Comments

@kellertuer
Copy link
Contributor

I ran into an interesting problem, which I think even started with the last beaking change – but not only did I have to find time to narrow it down, it is also a bit complicated to describe.

Status

Currently when running Franklin locally (seems fine on CI) on Avery first run I got an error, but when just (in the same environment) running it again, it was fine.
The error message was, that some of my page vars seem to be nothing, but I could not narrow that down. Until today.

In the folder https://github.com/kellertuer/kellertuer.github.io/tree/master/projects I use the page-variables to store metadata about the projects. Now the code loading them is

https://github.com/kellertuer/kellertuer.github.io/blob/32a223db8fcc907fb6ad67523ef72f77cab318a1/utils.jl#L17-L29

Where I mainly crawl the folder and for every file I read the metadata into a large dict. For two of the projects ( https://github.com/kellertuer/kellertuer.github.io/blob/master/projects/mvirt.md and https://github.com/kellertuer/kellertuer.github.io/blob/master/projects/secondordertv.md ) being nothing) besides the title for the first.
This also caused the errors, since I assumed that the start is always a proper date. Which then it was not for these two.

So: What might be reasons for these two files to not be able to load the pagevars? Is that a bug in Franklin or a problem on my side ;) ?

@kellertuer
Copy link
Contributor Author

kellertuer commented Mar 6, 2024

Addon: As far as I can see, there seems to be an upper bound of variables being loaded? It always affects the last two files in the folder.

If I rename, e.g. graph-laplace.md to xgraphlaplace.md it is the one without pagervars. So is there maybe an global user bound how many can be accessed also maybe in the one loop that I do?

edit: Now I am super confused. I thought: Well. If loading all is maybe too much, let ´'s do the loading of page variables per single page and maybe that works. That worked perfectly in the running session when I developed that. But once I restarted Julia now the single-load parts always and only read nothings. So I think I have a major misunderstanding (after about 8 years of using them) how page-vars load an how they can be accessed.

edit2: Ah. It nothings on first run, but if I change the file while the life-server is running (the utils.jl that is) it works fine.

So. After so much time of debugging. Why is that the case? And how can I access pagevars in an hfun function already on first run?

edit3: Surprisingly (I left in a bit of debug) it works fine on CI. Seems to me like the page-vars are maybe loaded in parallel or so? See this debug https://github.com/kellertuer/kellertuer.github.io/actions/runs/8176798601/job/22357013932#step:5:374 where all pagevars are displayed nicely. Locally I loose most of them, sometimes only the last (now its the oldest projects, since I sort first before accessing them now). Currently the last 2. But as soon as Franklin reloads on LIveServer all is fine.

Sorry to not being able to narrow it down further. But if possible, that loading pagevars could be finished before calling any hfun_ that would be great :)

@bhvieira
Copy link

bhvieira commented Mar 9, 2024

I have been suffering from something similar for a while now. At https://bhvieira.github.io/blog/ in the deployment the pagevars for posts from 2020 are not retrieved correctly (this works flawlessly in local)

@bhvieira
Copy link

This was corrected with a @delay macro

@kellertuer
Copy link
Contributor Author

Can you make that a bit more precise where you put that and how @delay works there?

@kellertuer
Copy link
Contributor Author

Thanks, will try that on my function later as well then.

@kellertuer
Copy link
Contributor Author

Ah, works great! Thanks for finding that out.

@bhvieira
Copy link

Glad to hear!

cpfiffer added a commit to cpfiffer/cameron-blog that referenced this issue Jul 9, 2024
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

2 participants