Correct way to handle meta tags

I have a project where I have a default description meta tag, but in some pages I want o set a custom description meta tag.

At the moment I have this on my layout file:

<?php $this->registerMetaTag(['name' => 'description','content' =>'DEFAULT DESCRIPTION'], 'description');?>

and on some views I have the same code

<?php $this->registerMetaTag(['name' => 'description','content' =>"CUSTOM DESCRIPTION"], 'description');?>

The problem is that the layout file is handle after the view file so I will always get the default description. What is the correct way to handle this?

You can use the params property of the view component for it.

Guide > Application Structure > Views > Sharing Data among Views

Exactly this seams to be one solution.

Thank you softark.