Advertisement:

Author Topic: How to noindex only category page  (Read 1787 times)

developersend

  • Newbie
  • *
  • Posts: 30
How to noindex only category page
« on: July 03, 2017, 12:42:18 am »
How to noindex only category page ? I need Google robots index all page but don't index category page.

developersend

  • Newbie
  • *
  • Posts: 30
Re: How to noindex only category page
« Reply #1 on: July 03, 2017, 12:50:33 am »
I am use bender 3.1.4 theme

developersend

  • Newbie
  • *
  • Posts: 30
Re: How to noindex only category page
« Reply #2 on: July 03, 2017, 10:47:06 pm »
Please help me

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #3 on: July 03, 2017, 11:39:54 pm »
You could put in your header's theme the noindex meta tag

https://support.google.com/webmasters/answer/93710?hl=en


Code: [Select]
<?php if(condition) echo '<meta name="robots" content="noindex">';?>
</head>

Maybe someone could help with that condition.
« Last Edit: July 03, 2017, 11:41:56 pm by marius-ciclistu »

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: How to noindex only category page
« Reply #4 on: July 04, 2017, 12:11:05 am »
Code: [Select]
osc_is_search_page()

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #5 on: July 04, 2017, 01:24:34 am »
Thank you Liath.

developersend

  • Newbie
  • *
  • Posts: 30
Re: How to noindex only category page
« Reply #6 on: July 04, 2017, 07:37:56 am »

Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: How to noindex only category page
« Reply #7 on: July 04, 2017, 12:06:14 pm »
It's just an addition to the post from marius-ciclistu


put this in your theme header.php
Code: [Select]
<?php if (osc_is_search_page()) { echo '<meta name="robots" content="noindex">'; } ?>

before
Code: [Select]
</head>

developersend

  • Newbie
  • *
  • Posts: 30
Re: How to noindex only category page
« Reply #8 on: July 06, 2017, 11:19:48 pm »
Two header.php show in my theme.

1. Public folder is there

2. bender/common/header.php

I'm paste code both file but can't changes anything.

My question is "How to noindex only category page ?"

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #9 on: July 06, 2017, 11:25:56 pm »
2. bender/common/header.php

Osclass has category pages displayed as search pages in that category, so you will get all search pages noindexed.

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #10 on: July 06, 2017, 11:31:46 pm »
If you want only some specific categories no indexed, you could use
osc_category_id($locale = "") - Gets the id of the current category
https://doc.osclass.org/HCategories.php

Liath could help you adapt this function to your needs. I'm in haze regarding that $locale argument.


EDIT:
or
osc_category() - Gets current category
« Last Edit: July 06, 2017, 11:40:38 pm by marius-ciclistu »

developersend

  • Newbie
  • *
  • Posts: 30
Re: How to noindex only category page
« Reply #11 on: July 09, 2017, 12:15:48 am »

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #12 on: July 09, 2017, 03:16:43 am »
Code: [Select]
if(osc_item_id()==598)
Liath, is there a function to test if the page is item page?



Liath

  • issues
  • Hero Member
  • *
  • Posts: 1346
  • </html> the end is always near
Re: How to noindex only category page
« Reply #13 on: July 09, 2017, 03:25:22 am »
osc_is_ad_page() - Get if user is on ad page


just take a look in the official documentation ;)

marius-ciclistu

  • issues
  • Hero Member
  • *
  • Posts: 1652
  • "BE GRATEFUL TO THOSE THAT SUPPORTED YOU"
Re: How to noindex only category page
« Reply #14 on: July 09, 2017, 03:43:03 am »
TY. I'm on mobile now.

So the complete answer is:

Put this in your header before </head>
Code: [Select]
<?php if(osc_is_ad_page()) if(osc_item_id()==598) echo '<meta name="robots" content="noindex">'?>
« Last Edit: July 09, 2017, 03:49:45 am by marius-ciclistu »