Get value from a txt file

hello,

i have page template called ‘animals’ and im calling the values from a ‘cars’ template.

i used page(‘cars’)->field()

i have seo plugin and i want to get the txt value generated from a ‘cars’ page.

Title: Cars

----

Seo: 

-
  seo-title: "Toys"
  seo-description: "Some of our website visitors might not have the best intentions, they might try to attack the website by trying to inject malicious code. "

----

Keywords: cab

----

now i want to get the seo-title value which is ‘Toys’
i tried page(‘cars’)->seo() but it echo’s

-
  seo-title: "Lessonssss"
  seo-description: "Some of our website visitors might not have the best intentions, they might try to attack the website by trying to inject malicious code. "

That is because you’re dealing with structure fields.

What should work (untested) is something like page('cars')->seo()->toStructure()->first()->seo-title()->esc();

More info: https://getkirby.com/docs/cheatsheet/field-methods/toStructure

If you are using this plugin, then there seem to be helpers, see docs: https://github.com/jenstornell/kirby-seo/blob/master/docs/FRONTEND.md