<HEAD> inserted above <DOCTYPE> after compiled

Questions and answers about ShopSite Custom Templates

<HEAD> inserted above <DOCTYPE> after compiled

Postby skinnyalbert » Thu Sep 22, 2011 8:19 pm

Hi all,

I have 3 pages on my site. They are all using the same page template. The First page works as expected. My issue with the other pages is that there is extra code at the top that is overriding my page title, meta description, and keywords. This is on a live site, so I've removed specifics, but here is what is showing at top:

Code: Select all
<HEAD>
   <TITLE>..Same title on page 2 & 3..</TITLE>
        <META NAME="DESCRIPTION" CONTENT=". Same Description for each...">
        <META NAME="KEYWORDS" CONTENT="...">
   </HEAD><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta name="generator" content="ShopSite Pro 10 r7.4 (data - template-name">

<title>This is the correct Title entered on Page Content</title>


It seems this extra code was entered by the last developer somewhere on the site and it is being pulled in. I'm new to Shopsites, so hopefully you can provide some help. Again, all 3 sites are using the same template, and I've tried others with the same extra code at top. Any help appreciated. Thanks.
skinnyalbert
 
Posts: 3
Joined: Thu Sep 22, 2011 8:12 pm

Re: <HEAD> inserted above <DOCTYPE> after compiled

Postby Jim » Thu Sep 22, 2011 9:18 pm

These 3 lines are definitely not coming from ShopSite generate code since ShopSite doesn't do any xhtml code in the templates.
Code: Select all
/HEAD><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">

ShopSite does output this code
Code: Select all
<meta name="generator" content="ShopSite Pro 10 r7.4 (data - template-name">


1 Places you can check for those lines of code would be the Page Header under Preferences > Header/Footer (or Preferences > Layout Settings > Header)
2 The template that is used by the pages. There may be and [-- IF ... --] statement that is being executed or excluded depending on a field in the page data,
3 Any of the Page Text fields , Text 1, Text 2, Text 3 on the Edit Page Info screen for the page.
4 If the pages that have the extra code are product more-information pages then the code could be from the [-- DEFINE MORE_INFO_PAGE --] section of the product template.
5 Are the pages actually being generated by ShopSite? Maybe the pages were created manually or were created in ShopSite but the filename was changed so ShopSite isn't actually modifying them any more. You can test this by editing something on the page and then seeing if the page is updated with that information after you do a Utilities >Publish > Regenerate.

If you have just a few pages defined it won't be much of a problem to search the page fields such as text 1, 2, 3 for some of that text . I would do this by going to the Edit Page Info screen of the products and in the browser do Ctrl-F which will open a search box in the browser window. Type something that is in one of the 3 lines above like "xhtml" (without the quotes and see if it is found on any fields. If it is then you should remove the lines that shouldn't be on the page.
If you have a lot of pages it may be easier to download the pages in tab delimited format (Utilities > Database > Download >Pages ) and then open the file in Excell or another spreadsheet application and do the same type of search to see if the text is found in any fields.

Looking in the templates would be done under Merchandising> Custom Templates the Pages or Products > then Edit the template file and do a similar Ctrl-F search.

A link to the pages that are having problems may be helpful so we an see the actual code that is different on the pages.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Re: <HEAD> inserted above <DOCTYPE> after compiled

Postby skinnyalbert » Fri Sep 23, 2011 7:57 am

Thank you for the quick reply. Here is a link:

http://www.graysgristmill.com/store

This first page does not have the additional code, but if you click the tab for CookBooks & More you'll see the extra code is inserted on top.

I'm using the same page template for both of these, and all of the extra fields and such are clear. I also created a new page in the store with this template and still received the extra code. It seems to be some sort of old code hard coded in somewhere in the site, but I'm using a new Page Template and Checkout Template, and my own Header and Footer info. I'm stumped on where this is being pulled from.

Again any help is appreciated.
skinnyalbert
 
Posts: 3
Joined: Thu Sep 22, 2011 8:12 pm

Re: <HEAD> inserted above <DOCTYPE> after compiled

Postby skinnyalbert » Fri Sep 23, 2011 8:00 am

I just noticed that if I click "My Store" in the admin, the version of my store (front page included) has this extra code .

i.e. index.html is written in the same way, but the page that loads from the root, shows the correct title.

Thought this might be helpful.
skinnyalbert
 
Posts: 3
Joined: Thu Sep 22, 2011 8:12 pm

Re: <HEAD> inserted above <DOCTYPE> after compiled

Postby Jim » Fri Sep 23, 2011 10:06 am

I can't tell what is being loaded by the /store/ url. I tried index.htm, index.php and neither of those exist but there must be some default filename being loaded by the webserver.
Viewing the source of the pages that load from /store/ and /store/index.html I see quite a few blank lines before the
<!DOCTYPE html PUBLIC "-//W3C//DTD ... line.
If I select the blank lines going backwards from the <!DOCTYPE ... line I see the exact same pattern of hidden characters, probably spaces, at the same locations in both files. The number of blank lines in the index.html page between the <HEAD> line and the <!DOCTYPE... lines is the same as the number of blank lines in the page that loads from store/. This leads me to believe that the page that is loading from /store/ has been manually edited to remove the initial 5 lines that are showing on the index.html page. (Note: ShopSite outputs a blank line when it comes to a comment (line starting with #) in the template. So the blank lines probably represent comments in the grist-page template. )

Look at the template grist-page found under Merchandising > Custom Templates > Pages and see what the first 30 or so line of the template are. My guess is that you will either find an [-- INCLUDE ...--] statement or the 5 lines <HEAD>...</HEAD> that are displaying at the top of the html source of the index.html page. If that is the case you could remove that section. If you have any doubt send me a copy of the template by email or pm. (buttons to do this are on the right side of the post under my name.)
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 22 guests