# Franklin.pagevar("menu1.md", :title)

**URL:** <https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975>\
**Category:** General Usage\
**Tags:** franklin\
**Created:** [January 21, 2022, 11:09am UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975 "2022-01-21T11:09:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paradoxical-rhapsody](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradoxical-rhapsody/32/33021_2.png) [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Post date:** [January 21, 2022, 11:09am UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975/1 "2022-01-21T11:09:53Z")

</div>

After initialize a site using `newsite("test")`, in the interactive environment I ran the statement

```julia
Franklin.pagevar("menu1.md", :title)

```

It throws the following error msg:

```julia
julia> Franklin.pagevar("menu1.md", "title")
ERROR: KeyError: key :folder not found
Stacktrace:
 [1] getindex(t::OrderedCollections.LittleDict{Symbol, String, Vector{Symbol}, Vector{String}}, key::Symbol)
   @ Base .\abstractdict.jl:497
 [2] path
   @ C:\Users\zengc\.julia\packages\Franklin\AGBc8\src\utils\paths.jl:71 [inlined]
 [3] pagevar(rpath::String, name::String; default::Nothing)
   @ Franklin C:\Users\zengc\.julia\packages\Franklin\AGBc8\src\utils\vars.jl:261
 [4] pagevar(rpath::String, name::String)
   @ Franklin C:\Users\zengc\.julia\packages\Franklin\AGBc8\src\utils\vars.jl:246
 [5] top-level scope
   @ REPL[6]:1

```

I have to use `pagevar` in interactive environment for test purpose, but I have no idea how to solve this error. Could you @tlienart kindly give me some advices?

---

<div class="post-metadata">

**Author:** ![paradoxical-rhapsody](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradoxical-rhapsody/32/33021_2.png) [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Post date:** [January 21, 2022, 11:11am UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975/2 "2022-01-21T11:11:32Z")

</div>

`Franklin.pagevar("menu1.md", :title)` throws the same error.

---

<div class="post-metadata">

**Author:** ![tlienart](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlienart/32/7640_2.png) [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Post date:** [January 21, 2022, 12:05pm UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975/4 "2022-01-21T12:05:44Z")

</div>

Ok I understand you want to experiment with `pagevar` inside the REPL however you have to understand a little bit about how Franklin does stuff for this.

When calling `serve`, Franklin looks at the path (typically your current working directory) and builds a representation of paths that it keeps track of, namely the `:folder` (corresponds to the root where your website is) but also for instance `:site` which is the output path where files are written.

These paths are typically irrelevant for the users and so this is created upon starting `serve` and then cleaned up after `serve` has finished. So when you do `pagevar` **after** stopping a session, these paths are not defined anymore and so `pagevar(...)` doesn’t have the path hierarchy it needs in order to resolve paths.

There are two things you can do here:

1. (probably what you want) run `serve(...; single=true, cleanup=false)` which will do a single pass to look at your site, build it, stop and will not clean things up so that you can inspect the various internals as you see fit (you can also check out `Franklin.GLOBAL_VARS` and `Franklin.ALL_PAGE_VARS` for instance to check the representation of page variable assignments)
2. (probably what I would suggest) run `serve(...)` without specific keywords and experiment within a page while the server is running with `{{fill var from}}` so for instance `{{fill title menu1}}`

---

<div class="post-metadata">

**Author:** ![paradoxical-rhapsody](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradoxical-rhapsody/32/33021_2.png) [@paradoxical-rhapsody](https://discourse.julialang.org/u/paradoxical-rhapsody)\
**Post date:** [January 21, 2022, 3:24pm UTC](https://discourse.julialang.org/t/franklin-pagevar-menu1-md-title/74975/5 "2022-01-21T15:24:39Z")

</div>

Thank you for your detailed explanation.
