Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SEO html: <meta> tags in <body> instead <head>


Recommended Posts

Hi everybody

I am studying html code produced by Phoenix Version 1.0.3.0 related to SEO Issues.

I have set up 2 languages set up in Phoenix.
-en english
-de german (set as default language)

The english language html code works fine (see attached picture head_en.jpg).
All the <meta> tags are properly shown in the <head> section of the html code.

 

The german lanugage html code is not correct (see attached picture head_de.jpg),
all <meta> tags are shown in the <body> section of the html code,

This is in my opinion wrong. The <meta> tags were not properly crowled.
(template_top.php original version) 

Somebody any ideas, what went wrong?

 

 

head_en.jpg

head_de.jpg

Link to comment
Share on other sites

Well, it's language specific, so I'd check the part of the language files that specifies that

<htmldir="ltr" lang="de">

My guess is that you're missing a space in

define('HTML_PARAMS', ' dir="ltr" lang="de"');

in the german.php file.  Note that there should be a space before the dir entry. 

Your browser doesn't know what an htmldir tag is, so it assumes that it's part of the body.  So your browser implicitly creates the html, head, and body tags.  Then it removes the ones that template_top.php created. 

Always back up before making changes.

Link to comment
Share on other sites

I have a further question related to <header>.

I have created several individual pages based on conditions.php.
in the <title> I would like to see "Our GTCs I Philatelie Attias, CH-5620 Bremgarten"

How can I add "Our GTCs " to the title which relates to 'HEADING_TITLE' in the coresponding language file?

Any ideas? 

 

Link to comment
Share on other sites

4 hours ago, Philo2005 said:

How can I add "Our GTCs " to the title which relates to 'HEADING_TITLE' in the coresponding language file?

Does adding a

define('META_SEO_TITLE', 'Our GTCs');

help?  May require ht_pages_seo to be installed in admin > Modules > Header Tags (if it is not already). 

You may also want to look at how ht_product_title.php works and adapt for your use.  I'm thinking of copying that file to ht_heading_title.php, changing the class name and $code to ht_heading_title, replacing all instances of PRODUCT_TITLE with HEADING_TITLE, and replacing the contents of the execute function with something like

    function execute() {
      global $PHP_SELF, $oscTemplate;

      if (in_array(basename($PHP_SELF), [ 'attias_beratung.php', 'attias_impressum.php' ])) {
        $oscTemplate->setTitle(HEADING_TITLE);
      }
    }

Adjust the list of file names as necessary for your shop.  Remember that you have to install the module in admin before it will do anything.  You want it to have a low sort order number, as you want it to act before other modules. 

And if it wasn't clear, change things like

      $this->title = MODULE_HEADER_TAGS_PRODUCT_TITLE_TITLE;

to look like

      $this->title = MODULE_HEADER_TAGS_HEADING_TITLE_TITLE;

throughout the file. 

Always back up before making changes.

Link to comment
Share on other sites

@ecartz

Thank you very much, the first part is exactly what i needed. The second part i will go on later.
Studying the "ht_pages_seo" which i already activated, I found out that the next step having the <meta  name= "description" content included is also defined there.

So for conditions.php in english i defined: 

define('META_SEO_TITLE', 'Our GTCs');
define('META_SEO_DESCRIPTION', 'General Terms of Conditions (GTCs) of Philatelie Attias, CH-5620 Bremgarten AG');

as for further languages i did this too.

And this works fine for title and meta in html code!!! Great!

So I hope now,  with these points in this topic  to reduce my 4500 error pages by google to 0! -:)

Link to comment
Share on other sites

On 11/16/2019 at 12:52 PM, ecartz said:

 


define('HTML_PARAMS', ' dir="ltr" lang="de"');

 

@ecartz

What exactly is this definition doing?

I do have this in my german.php file,
but in the english.php it looks like this:

define('HTML_PARAMS', '');

Do i need to change this to ?

define('HTML_PARAMS', ' dir="ltr" lang="en"');

I am asking this because i am optimizing my pages with the google search consol, which created tousands of Errors …
and I am wondering how to define my pages in 2 languages as canonical, but not identical?

<link rel="canonical" href="https://www.attias.ch/ishop/attias_index.php">


There is no hint in my pages which languages is shown, except the german ones with:
 

<html dir="ltr" lang="de"><head>

code of Website to follow

</body></html>

How did manage you this?

Link to comment
Share on other sites

5 hours ago, Philo2005 said:

What exactly is this definition doing?

To be honest, I don't really know.  I mean it's setting the reading direction to left to right (so I read the "What" first and the "doing" last in your question).  Basically it's saying that the language is not like Hebrew, which is right to left.  And it's saying that the language is Deutsch (German).  It's not specifying a dialect of Deutsch like en-US or en-GB do for English.  It's possible that it would make sense to put in a lang parameter on the English pages.  I'm not sure what it should be. 

I would be better able to help you if someone told me what effect should be on the pages.  I could try to figure out how to implement that in code. 

Since you don't have separate English pages for the US and UK, your proposed define is correct.  Whether it is better to set it or not, I don't know. 

Always back up before making changes.

Link to comment
Share on other sites

7 hours ago, ecartz said:

To be honest, I don't really know.  I mean it's setting the reading direction to left to right (so I read the "What" first and the "doing" last in your question).  Basically it's saying that the language is not like Hebrew, which is right to left.  And it's saying that the language is Deutsch (German).  It's not specifying a dialect of Deutsch like en-US or en-GB do for English.  It's possible that it would make sense to put in a lang parameter on the English pages.  I'm not sure what it should be. 

I would be better able to help you if someone told me what effect should be on the pages.  I could try to figure out how to implement that in code. 

Since you don't have separate English pages for the US and UK, your proposed define is correct.  Whether it is better to set it or not, I don't know. 

Thank you for your answer ecartz, I implemented the code  <html dir="ltr" lang="en">
in the english.php and wait what it will create by google search console.

Somebody other any idea?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...