Getting Meta description and Featured image of the blog listing page

Hello,
I have a navigation menu where I can fill in pages but also select the blog listing page. the normal pages have a pageId. but the blog_listing page doesn’t have that so I am not able to grab the meta description or featured image of this page.
This is the code I use to make the menu. (I want for each child item to show the feautured image + title + url + metadescription)

<div class="child_items">
 {% set page_ids = [] %}
 {% for child_item in item.children %}
 {% set page_id = child_item.pageId %}
 {% set _ = page_ids.append(page_id) %}
 {% endfor %}

 {% set pages = content_by_ids(page_ids) %}

 {% for child_item in item.children %}
 <div class="child_item">
 <div class="child_image">
 {% set page_id = child_item.pageId %}
 {% if page_id in pages %}
 {% set page = pages[page_id] %}
 {% if page.featured_image %}
 <img class="test" src="{{ page.featured_image }}" alt="Featured Image">
 {% endif %}
 {% endif %}
 </div>
 <div class="child_text">
 <a class="item" href="{{ child_item.url }}">{{ child_item.label }}
 <svg class="long_arrow" width="21" height="8" viewBox="0 0 21 8" xmlns="http://www.w3.org/2000/svg">
 <path d="M20.3536 4.35355C20.5488 4.15829 20.5488 3.84171 20.3536 3.64645L17.1716 0.464466C16.9763 0.269204 16.6597 0.269204 16.4645 0.464466C16.2692 0.659728 16.2692 0.976311 16.4645 1.17157L19.2929 4L16.4645 6.82843C16.2692 7.02369 16.2692 7.34027 16.4645 7.53553C16.6597 7.7308 16.9763 7.7308 17.1716 7.53553L20.3536 4.35355ZM0 4.5H20V3.5H0V4.5Z" fill="white"/>
 </svg>
 </a>
 <p>
 {% if page_id in pages %}
 {% set page = pages[page_id] %}
 {{ page.meta_description }}
 {{blog_listing}}
 {% endif %}
 </p>
 </div>
 </div>
 {% endfor %}

Item.children gives back this:
[PageTreeNode{label=Unsere Story, url=test.com/test, children=, activeBranch=true, activeNode=true, level=2, pageTitle=[20.] Company_Our story, pageId=71354367177, slug=de/unsere-geschichte, linkTarget=null}, PageTreeNode{label=Unternehmens Nachrichten, url=test.com/test, children=, activeBranch=false, activeNode=false, level=2, pageTitle=TESTNews, pageId=null, slug=de/test-news, linkTarget=null}, PageTreeNode{label=Geschichte , url=test.com/test, children=, activeBranch=false, activeNode=false, level=2

Hi @BBecker1

Based on the provided code snippet, it seems that you are trying to fetch the meta description and featured image for the child items in a navigation menu. However, you mentioned that the blog listing page does not have a `pageId`, and as a result, you are unable to retrieve the desired information.

To address this issue, you can modify your code to handle the blog listing page separately. Instead of relying on the `pageId` for the blog listing page, you can use a different approach to fetch its meta description and featured image.

Here’s an updated version of the code that includes a separate condition for the blog listing page:

```html
{% for child_item in item.children %}
<div class=“child_item”>
<div class=“child_image”>
{% if child_item.pageId %}
{% set page_id = child_item.pageId %}
{% if page_id in pages %}
{% set page = pages[page_id] %}
{% if page.featured_image %}
<img class=“test” src=“{{ page.featured_image }}” alt=“Featured Image”>
{% endif %}
{% endif %}
{% elseif child_item.label == “Blog Listing” %}
<!-- Handle blog listing page separately -->
{% set blog_listing_page = pages[“blog_listing_page_id”] %}
{% if blog_listing_page.featured_image %}
<img class=“test” src=“{{ blog_listing_page.featured_image }}” alt=“Featured Image”>
{% endif %}
{% endif %}
</div>
<div class=“child_text”>
<a class=“item” href=“{{ child_item.url }}”>{{ child_item.label }}</a>
<p>
{% if child_item.pageId %}
{% set page_id = child_item.pageId %}
{% if page_id in pages %}
{% set page = pages[page_id] %}
{{ page.meta_description }}
{% endif %}
{% elseif child_item.label == “Blog Listing” %}
<!-- Handle blog listing page separately -->
{% set blog_listing_page = pages[“blog_listing_page_id”] %}
{{ blog_listing_page.meta_description }}
{% endif %}
</p>
</div>
</div>
{% endfor %}
```

In this updated code, the condition for the blog listing page is added separately using the `child_item.label` check. Adjust the `blog_listing_page_id` placeholder with the actual ID or identifier for your blog listing page.

By incorporating this separate handling for the blog listing page, you can fetch its meta description and featured image without relying on the `pageId`.

Please ensure you replace `blog_listing_page_id` with the correct identifier for your blog listing page in the `pages` dictionary to retrieve the desired information accurately.

Thanks for your response! but sadly I cannot get this to work?
I go to settings and then get the blog_listing ID right? thats in the url?
I think U didn’t understand me completely. I found out what you did but its not really what I want. The blog Listing page itself so the page where the blogs are displayed on has a featured image. I want to show that featured image not one of the blogs.