Meta Tags

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
I have a older version of VS 2005 and notepad and notepad++
Can I just FTP the file down and use one of these programs to edit it?
Thanks
8 years ago
lwflowers wrote:
I have a older version of VS 2005 and notepad and notepad++
Can I just FTP the file down and use one of these programs to edit it?
Thanks

No problem.
Notepad is all you need. Just FTP it down, fix it and upload it again-

Steve
8 years ago
embryo wrote:
\Views\Shared\_Root.Head.cshtml

approximately line 24

<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
<!-- add new meta tags here -->


..but be aware that inserting meta tags here will actually cause them to appear on all your public pages...not just the Home page

And...if you have a custom theme, you will need to edit the _Root.Head.cshtml located inside your theme folder instead:
\Themes\YourCustomThemeName\Views\Shared\_Root.Head.cshtml

I think most folks just upload the verification file from those engines as opposed to trying to modify the code view by adding the meta tag...but either will work.

Another thought I had is that if you really need for the additional meta tags to appear ONLY on the home page, you could add your meta tags like this:

string currentpage=HttpContext.Current.Request.ServerVariables["URL"];
  if (currentpage == "/")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }


That would cause those 4 meta tags to appear only on the home page.


To just have them on the home page AND a topic page named "someothertopicpage", you'd just have this:


string currentpage=HttpContext.Current.Request.ServerVariables["URL"];
  if (currentpage == "/" | currentpage == "/someothertopicpage")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }
8 years ago
So it wouls look something like this:

<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
string currentpage=HttpContext.Current.Request.ServerVariables["HomePageURL"];
  if (currentpage == "/")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }
8 years ago
lwflowers wrote:
So it wouls look something like this:

<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
string currentpage=HttpContext.Current.Request.ServerVariables["HomePageURL"];
  if (currentpage == "/")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }


It should be look like bellow

@using Nop.Core.Infrastructure
<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
@{string currentpage=HttpContext.Current.Request.ServerVariables["HomePageURL"];}
  @if (currentpage == "/")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }
8 years ago
And also add top of the file


@using System.Web;
7 years ago
@using Nop.Core.Infrastructure
@using System.Web;
<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
@{string currentpage=HttpContext.Current.Request.ServerVariables["HomePageURL"];}
  @if (currentpage == "/")
  {
  <meta name="Author" content="Your Name">
  <meta name="something" content="nothing">
  <meta name="whatever" content="whenever">
  <meta name="anything" content="everything">
  }


I have added the 5 other metas I needed. Just fyi, when this line of code is added
@{string currentpage=HttpContext.Current.Request.ServerVariables["HomePageURL"];}
  @if (currentpage == "/")

the metas do not show up, but when removed they appear. also if you set up the default title in config settings the title will duplicate on the other title pages. So with this code you cannot set default title in conf > settings > general > seo > default title

I am glad the others are working. here is my current code:  

@using Nop.Core.Infrastructure
@using System.Web;
<!DOCTYPE html>
<html @Html.Partial("LanguageAttributes")>
<head>
    <title>@Html.NopTitle(true)</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    <meta name="description" content="@(Html.NopMetaDescription())" />
    <meta name="keywords" content="@(Html.NopMetaKeywords())" />
    <meta name="generator" content="nopCommerce" />
    <meta name="Author" content="Your Name">
    <meta name="something" content="nothing">
    <meta name="whatever" content="whenever">
    <meta name="anything" content="everything">
7 years ago
U better use a @Html.Widget("head_html_tag") and use a plugin like http://www.hezyziv.com/all-in-one
7 years ago
what would that do. They are working, just a little finese thats all.
Really just needs to be able to add more meta tags to the home page by default.
3 years ago
When sharing website address or specific page at facebook it shows wrong preview.
For link share, it shows weird preview image.
For product page share, it shows wrong product preview image.

The open graph meta tag is enabled (General settings). After searching google found that I need to add open graph meta tag. So place the below code at custom <head> tag:

<meta property=”og:title” content=”site name” />
<meta property=”og:url” content=”site url” />
<meta property="og:image" content="site url/images/0000034_0.jpeg" />

But nothing changed. I also checked by disabling open graph meta tag. Still it shows wrong preview at facebook.

Could anyone please help.
Thanks in advance.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.