N
N
nedland2021-08-13 10:57:12
PHP
nedland, 2021-08-13 10:57:12

How to replace metatag on current page?

Perhaps I will ask in a not quite technical language (because I'm just learning), but there is a problem.
There is index.php which includes files metatag.php (in which tags) and post.php, news.php, blog.php (depending on the link opens the right one) with page reload.
In the metatag.php file, the tag values ​​are taken from the database. In the post.php or news.php file itself, there is only a part with posts, and the framework, etc. is described in index.php and other files.
When I go to the posts from the main page, it seems like the post opens, and after that the full post, but the tags remain the same (from metatag.php).
In post.php there is a variable kratkoeopisanie, which also takes a brief description of the news, post, etc. from the database.
In simple terms, when you go to the posts, the index loads the data from post.php, executes and displays them (with a page reload), but the meta tags remain initial.
And now the main question, is it possible to use php or js to replace the description meta tag with the value from the kratkoeopisanie variable when going to post.php?
Yes, dancing with a tambourine, but there is no desire to redo everything, but a lot of everything. Everything I've tried has failed

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question