# Dynamically load datafiles based on variables

**URL:** <https://discourse.gohugo.io/t/dynamically-load-datafiles-based-on-variables/9349>\
**Category:** support\
**Created:** [November 23, 2017, 8:56pm UTC](https://discourse.gohugo.io/t/dynamically-load-datafiles-based-on-variables/9349 "2017-11-23T20:56:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![digitalcraftsman](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/digitalcraftsman/32/4142_2.png) [@digitalcraftsman](https://discourse.gohugo.io/u/digitalcraftsman)\
**Post date:** [November 23, 2017, 9:18pm UTC](https://discourse.gohugo.io/t/dynamically-load-datafiles-based-on-variables/9349/2 "2017-11-23T21:18:35Z")

</div>

Hello @May_Meow,

try `.Site.data.(.Site.Params.datafile)`. Note, that the file extension / format isn’t used if you access the content of data files with `.Site.Data`. Hence it can be omitted in the front matter.

---

_[View the full topic](https://discourse.gohugo.io/t/dynamically-load-datafiles-based-on-variables/9349)._
