You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose that I have some variable defined in config.md, let's call it id. And now I want to use that variable when I define the title, in the block wrapped by +++. Is it possible? So far, Franklin says id doesn't exist.
My goal? I wanted to define an ordered list of files in config.m, and then use eachindex to give a number to each. Then, I wanted to add that number to title on each local page. But it seems that global variables are not allowed within +++?
Thanks!
The text was updated successfully, but these errors were encountered:
If you define a variable in config.md you can access it in local pages with globvar(:name_of_var) so e.g.
config.md:
+++
a = "hello from global"
b = 235
+++
page1.md:
+++
c = globvar(:b)
+++
This is `c`: {{c}}
Assuming you have something like <title>{{title}}</title> in your layout files, you could also have on page1.md:
+++
title = globvar(:a)
+++
and the title of that tab/page will be "hello from global".
I hope that gives you elements to do what you wish for.
Note: just in case, from your description it seems you might need to use fd_rpath on local pages i.e. locvar(:fd_rpath) this will return the relative path to the current file. You can test it by adding
Current relative path: **{{fd_rpath}}**
on pages and seeing what it shows.
(closing but feel free to reopen if you still have questions)
Suppose that I have some variable defined in
config.md
, let's call itid
. And now I want to use that variable when I define the title, in the block wrapped by+++
. Is it possible? So far, Franklin saysid
doesn't exist.My goal? I wanted to define an ordered list of files in
config.m
, and then useeachindex
to give a number to each. Then, I wanted to add that number totitle
on each local page. But it seems that global variables are not allowed within+++
?Thanks!
The text was updated successfully, but these errors were encountered: