Using the the Block Setting into a Metafield Liquid Tag

I am making a new section in my product template.

I have a block setting {{ block.settings.metafield_video1 }} which will generate a single line text “recipe.video_url”. From a metafield on a BLOG post so the full liquid should result in {{ article.metafield.recipe.video_url }} giving a www.youtube.com url . I am using the following liquid to achieve this

{% assign video_metafield_key = block.settings.metafield_video1 %}
{% assign video_url = video_metafield_key | prepend: "article.metafields." %}

This will result in

article.metafield.recipe.video_url

However, if i put in {{ video_url }} it will result in the string text “article.meta field.recipe.video_url” instead of running the code and not resulting in “www.youtube.com”.

Thus, making this code not work:

I have also tried

{% assign video_url = article.metafields.{{ block.settings.metafield_video1 }} %}

which gives me a “Liquid syntax error: Unexpected character”

and

{% assign video_url = article.metafields[block.settings.metafield_video1] %}

which gives me “{}”

Thank you for your help.

@Jessi44 thanks for posting here,

im not understand your liquid logic. why are you using the article Metfield on a product template? and how you combine these 2 different code in 1 sentence.
article.metafields[block.settings.metafield_video1]???

can you please explain simply what is your basic need?

So I’m trying to make a recipe section under my product page and use the video and data metafields from my blog recipe. Thus, I need to connect my article.metafields to my product template in order for this to work. What i tried to do is make a block section text that i can write the correct article.metafields into it and then have the liquid calculate the metafield based off the block text. I hope that makes sense.
Product A (block.settings.text1) is a product that’s used in Recipe Article A (article.metafields.video1) so that “Video1” is shown on Product A

Originally I only wanted to replace the namespace.key using the block.settings. thus the article.metafields[block.settings.metafield_video1] where the “block.settings.metafield_video1” is the namespace.key and it becomes article.metafields.recipe.video1