Dynamic Meta Descriptions

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Get Involved
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

gwmbox wrote:is the code edits in the 2nd post the correct code
Yes.
gwmbox wrote:create a list of words for it not to include in the keyword metadata
Open /viewtopic.php and in my code find:

Code: Select all

        $sKeyWord= implode( ', ', array_keys( $aDistinct ) );
Before, add:

Code: Select all

        /*** 2012-08-16 BEGIN AmigoJack
          Strip predefined keywords ***/
        $aStrip= array
        ( 'where'=> 0
        , 'when'=> 0
        , 'then'=> 0
        , 'that'=> 0
        );
        
        foreach( $aDistinct as $iDistinct=> $sDistinct )
        if( isset( $aStrip[$iDistinct] ) ) {
          unset( $aDistinct[$iDistinct] );
          unset( $aStrip[$iDistinct] );
        }
        /*** 2012-08-16 END ***/ 
Untested.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
infonet
Registered User
Posts: 44
Joined: Tue Mar 08, 2011 2:20 pm

Re: Dynamic Meta Descriptions

Post by infonet »

this mod and possbile ? This very works for seacrh engine viewtopic.php?f=72&t=2162258#p13181230
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

I have no clue what you mean. Get someone who is really capable to read and write English - all your questions should be answered when reading this whole topic. My only alternative is German.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: Dynamic Meta Descriptions

Post by Theriddler1 »

Hi Amigojack i use you snippet for a time now, and working great but after the update phpbb 3.0.11 i get this:

Code: Select all

[phpBB Debug] PHP Notice: in file [ROOT]/viewtopic.php on line 1679: Undefined variable: sMetaDescription
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5022: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3913)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5024: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3913)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5025: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3913)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5026: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3913)
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Theriddler1
Registered User
Posts: 451
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Name: Theriddler❶
Contact:

Re: Dynamic Meta Descriptions

Post by Theriddler1 »

AmigoJack wrote:
Volksdevil wrote:with debug on
That's what's causing it. However, to also get rid of notices, find:

Code: Select all

// Output the posts   
Before, add:

Code: Select all

/*** 2011-03-03 BEGIN AmigoJack
  Initializing ***/
$sMetaDescription= '';
/*** 2011-03-03 END ***/
Can't believe i totally overlooked this :oops: shame on me, thanks for pointing me in the right direction.

it has been fixed now, have a great weekend and again thnx for your help.
Theriddler - Former Moderator @ phpBB.nl | phpBBservice.nl Team-member
Image My Extensions | buy me a beer Image
User avatar
secret_affection
Registered User
Posts: 84
Joined: Wed Jan 19, 2011 9:02 pm

Re: Dynamic Meta Descriptions

Post by secret_affection »

Amigo,

I just used the codes in your first post.

Great..................! Thanks buddy.
User avatar
secret_affection
Registered User
Posts: 84
Joined: Wed Jan 19, 2011 9:02 pm

Re: Dynamic Meta Descriptions

Post by secret_affection »

Sorry for the double post.

Amigo, I can get the descriptions in all viewtopic pages as per your modification.

My question is, How can I add some specific descriptions and key word only to the Index Page.!

Thanks in advance.
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

Open /index.php and find:

Code: Select all

// Assign index specific vars
$template->assign_vars(array(
After, add:

Code: Select all

  /*** 2012-10-01 BEGIN AmigoJack
    Assign index-specific meta data ***/
  'S_META_DESCRIPTION'=> '...replace with your description...',
  'S_META_KEYWORDS'=> '...replace with your keywords...',
  /*** 2012-10-01 END ***/
Like in previous steps, for every style you use open /styles/?/template/overall_header.html and find:

Code: Select all

<meta name="keywords" content="" />
<meta name="description" content="" />
Replace with:

Code: Select all

<meta name="keywords" content="{S_META_KEYWORDS}" />
<meta name="description" content="{S_META_DESCRIPTION}" />


For every style you use delete /cache/tpl_?_overall_header.html.php.

Untested.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
gengis
Registered User
Posts: 42
Joined: Wed Apr 25, 2012 4:14 pm

Re: Dynamic Meta Descriptions

Post by gengis »

Hi Amigo,
Firstly thanks for a great little bit of code!

I came across an issue in my forum where in some posts people post videos only, so there is a link to a video which automatically embedds the youtube video into it.

As a result there isnt any text to fill the content and description. Is there a way these could be filled by the title of the post in these cases?

Thanks in advance!
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

gengis wrote:the title of the post
...is for the first post also the topic title, and that one already goes to the <title>, which is surely indexed already - so I don't get the point in adding that to the meta description again.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
gengis
Registered User
Posts: 42
Joined: Wed Apr 25, 2012 4:14 pm

Re: Dynamic Meta Descriptions

Post by gengis »

Thanks for the prompt reply! Didnt think of that, ill keep it as it is.

Out of curiosity, I have been trying to add open graph meta tags to the site for Facebook. I am getting lots of errors on the FB debugger. Just to double check, would any of the changes in this thread affect any of the og:xxx tags?
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

Definitly not.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
niros435
Registered User
Posts: 8
Joined: Wed May 01, 2013 4:47 am

Re: Dynamic Meta Descriptions

Post by niros435 »

Hi AmgoJack,

Man, first of all just wanted to say Thank You for your efforts in writing all the ussefull information
in this topic...

I am using in on my board and it's super.

But i have noticed one error though.
Sometimes the keywords generated are plain numbers.

for example here

Code: Select all

http://www.letsdance.ro/forum/viewtopic.php?f=24&t=3567
the keywords generated are:

<meta name="keywords" content="Decembrie, 0, Lansat, Pagina, Oficiala, Facebook, Dance, Ultimile, Zile, Lucrat, Intens, Publicam, Fotografiile, Filmuletele, 1, Pana, Reusit, Doar, Adica, Poze" />

is there someway we can correct it?

Thank you :)
User avatar
AmigoJack
Registered User
Posts: 6113
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Dynamic Meta Descriptions

Post by AmigoJack »

Please attach your copy of /viewtopic.php (click "Upload attachment" when replying).
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Locked

Return to “[3.0.x] Support Forum”