Blocking google indexation of certain pages?

Hey guys !

Hope you are all doing well.

I’m launching my marketplace in a few days, and I’m ironing out a few things before D-Day.

I’ve got an issue with my indexation pages, Google indexes a lof of pages (too much !).

I have 2 two types of pages that are problematic :

  • Instructor Profile page, which is of Content Type “User”. My user can be of two type, instructor or standard and I’d like google to only index Instructor pages.
  • Courses page, which is of Content Type “Course”. My courses have several status (Draft, Published, rejected etc…) and I’d like Google to index only course that are Published.

I’ve thought about setting a redirection with a “When page is loaded” and some conditions in order to “mask” unwanted pages.

Would this be a good approach to prevent those pages from getting indexed ?

Do you guys have any other ideas ?

The best way to stop Google indexing certain pages is by either using noindex tags, or robots.txt.

But, in your case, as you want it to be dynamic based on User types and Course publication statuses, it will be better to add noindex tags to the relevant pages conditionally.

i.e. if the Current Page User’sType is Standard, add the noindex tag

And the same on the course page:

if the Current Page Course’s status is not Published, add the noindex tag.

To add noindex tags conditionally to the page, you can use something like the following, in the page html header…

on the profile page:

Current Page User's Type is Standard: format as text

For ‘Yes’ enter:

<meta name="robots" content="noindex">

And for ‘No’ just leave it blank.

Hey @adamhholmes !

Thanks for your reply, looks promising !

However, I have no coding knowledge, so I’m not sure how to implement that

Is there a way for me to find that type of code ?

Thanks for your time :slight_smile:

The only ‘code’ you need is the html noindex tag:

<meta name="robots" content="noindex">

The rest is just standard Bubble expressions.

Hey Adam !

Sorry for the late reply, I haven’t been able to check that sooner.

Unfortunately, it seems that Bubble won’t let me conditionaly change the HTML Header of a page…

Are you talking about the HTML header in the page editor or am I mistaken ?

Am I taking a wrong approach ?

Capture d’écran 2023-03-02 à 09.40.11

Indeed, you can’t use a Condition for this.

Are you talking about the HTML header in the page editor or am I mistaken ?

Yep…

Am I taking a wrong approach ?

Yes, you are… as I said you can’t use a condition for this, so you need to create a Booloean yes/no) statement directly in the page html header, and then format the output as text accordingly, as outlined in my previous post:

To add noindex tags conditionally to the page, you can use something like the following, in the page html header…

on the profile page:

Current Page User's Type is Standard: format as text

For ‘Yes’ enter:

<meta name="robots" content="noindex">

And for ‘No’ just leave it blank.

1 Like

Haaaaaaa okay !

I’ve got it ! I completely misread and misunderstood your explanations.

All clear now !

Thanks a lot Adam :slight_smile:

1 Like