1
votes

I'm aware about Google ignore most of the time, meta tag and use content. (This is not the point here)

I'm working on an existing web site, not created by me. I need a quick solution, I guess with variables.

The website construction: (no known template system)

index.html which is presentation page with language selection

index.php which embeding menu, content, footer several content pages that are embedded by index.php

What I need to do only for those 2 pages welcome_en.html and welcome_fr.html (these pages are embedded so no header possible on these page) to have different page title (browser title) and different META tag.

extra information

Language detection on index.php:

<?php
$lang = $_GET['lang'];
$page = $_GET['page'];
if ($_GET['page'] == "" || !$_GET['page']) {
$page = "welcome";
}
if ($_GET['lang'] == "" || !$_GET['lang']) {
$lang = "_fr";
}
?>

for the embeded menu, footer ect like this one

<?php include "menu.php";
  ?>

for the embedded content

 <?php
        //echo "$page$lang.html";
        $lang = preg_replace('/[^a-z0-9_ ]/i', '', $_GET['lang']);
        $page = preg_replace('/[^a-z0-9_ ]/i', '', $_GET['page']);
        include $page . $lang . ".html";
  ?>

The header info Meta tag and title are in index.php for all pages with no variables.

1
How are you recognizing language (cookie, session, get, post) ? Are you using some template system ? How you store your layout (header) file ? How you render those files ?retro
Hi I have add extra info to the post. Thankslena
I still need help with this any suggestion is welcome thankslena

1 Answers

0
votes

I have found a working solution

<?php 
if($page == "welcome" && ( $lang == "_en" || $lang == "") )
{
  echo '<title>English Title</title>';
  echo '<meta name="Keywords" content="English Keywords" />';
  echo '<meta name="Description" content="English Description" />';  
}
elseif($page == "welcome" && $lang == "_fr")
{
  echo '<title>French Title</title>';
  echo '<meta name="Keywords" content="French Keywords" />';
  echo '<meta name="Description" content="French Description" />';  
}
?>