# Get content from one page to appear on all pages

**URL:** <https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255>\
**Category:** Questions\
**Tags:** v3\
**Created:** [August 8, 2023, 10:31am UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255 "2023-08-08T10:31:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_E](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mark_e/32/10834_2.png) [@Mark\_E](https://forum.getkirby.com/u/Mark_E)\
**Post date:** [August 8, 2023, 10:31am UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255/1 "2023-08-08T10:31:45Z")

</div>

I understand how to display a pages content on a page, using the $page variable, and site content on a page using the $site variable ([Templates | Kirby CMS](https://getkirby.com/docs/guide/templates/basics#the-page-variable))

But how do I get content from one page (the homepage) to be added to several pages?

I currently have:  
`<meta property="og:description" content="<?= $page->description_meta_tag() ?>" />`

but want it to be something like  
`<meta property="og:description" content="<?= $home->description_meta_tag() ?>" />`

That doesn’t work. And neither does this:

`<meta property="og:description" content="<?= $page->find('home')->description_meta_tag() ?>" />`

These don’t work either  
`<meta property="og:description" content="<?= $page('home')->description_meta_tag() ?>" />`

`<meta property="og:description" content="<?= $page('index')->description_meta_tag() ?>" />`

Is this possible?

---

<div class="post-metadata">

**Author:** ![Mark\_E](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mark_e/32/10834_2.png) [@Mark\_E](https://forum.getkirby.com/u/Mark_E)\
**Post date:** [August 8, 2023, 10:56am UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255/2 "2023-08-08T10:56:34Z")

</div>

Okay, this works. It seems there is a difference between `page` and `pages`

`<meta property="og:description" content="<?= $pages->find('home')->description_meta_tag() ?>" />`

> [@Fetch / query content from another page](https://forum.getkirby.com/t/fetch-query-content-from-another-page/2240):
>
> Okay… this must be the most basic question ever, but I’ve never dealt with it before… Imagine this is my content-folder / site-setup; /1-home home.txt /2-about about.txt How do I get a field-value (e.g. “intro” which contains a introduction-text) from home.txt on the about-page? I tried several syntaxes, none of them did work… echo $page-\>find('home')-\>intro()-\>kt(); echo $page('home')-\>intro()-\>kt; It’s easy to parse the value from a field, directly linked to that page - but how do yo…

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 8, 2023, 12:27pm UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255/3 "2023-08-08T12:27:08Z")

</div>

An alternative would be to use the page helper:

```auto
if ($p = page('home')) {
  echo $p->title();
}

```

Note that you are usually better off if you make sure the desired page/file/whatever exists, before calling any member methods (like in the example).

If the object does not exist, you will get the famous calling xyz() on null error…

---

<div class="post-metadata">

**Author:** ![Mark\_E](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mark_e/32/10834_2.png) [@Mark\_E](https://forum.getkirby.com/u/Mark_E)\
**Post date:** [August 9, 2023, 9:46am UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255/4 "2023-08-09T09:46:45Z")

</div>

Right, got you, I simply thought if content didn’t exist, it simply wouldn’t display – rather than break the whole page.

Thanks for the tip about the page helper.

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [August 9, 2023, 9:37pm UTC](https://forum.getkirby.com/t/get-content-from-one-page-to-appear-on-all-pages/29255/5 "2023-08-09T21:37:53Z")

</div>

If you want to understand why it is the way it is, read this: [A brief intro to object oriented programming in PHP | Kirby CMS](https://getkirby.com/docs/cookbook/templating/understanding-oop)
