Extension talk:Description2

From MediaWiki.org
Jump to navigation Jump to search

Doesn't work properly on MW 1.27.0[edit]

So there are some pages on my wiki where this extension generate description meta tag not properly. It looks like this:

<meta name="description" content="ENCODED_CONTENT MTk0MzQPGRpdiBjbGFzcz0iZmxvYXRyaWdodCI+CjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcyI+PC9zY3JpcHQ+CjwhLS0gd2lraWpvdXJuYWwgLS0+CjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIgogICAgIHN0eWxlPSJkaXNwbGF5OmlubGluZS1ibG9jazt3aWR0aDoyNTBweDtoZWlnaHQ6MjUwcHgiCiAgICAgZGF0YS1hZC1jbGllbnQ9ImNhLXB1Yi00OTY1Mjk5MzM5MzQ0OTQ3IgogICAgIGRhdGEtYWQtc2xvdD0iNDc1Mzg1ODY2OCI+PC9pbnM+CjxzY3JpcHQ+CihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7Cjwvc2NyaXB0Pgo8L2Rpdj4= END_ENCODED_CONTENT
And here goes correct description of the article"/>

So there is some letters and it is marked ENCODED_CONTENT .... END_ENCODED_CONTENT.

How to fix this problem.

P.S. Some pages works fine and they have correct description meta tag(without this "ENCODED_CONTENT .... END_ENCODED_CONTENT"

Inclusion of PAGENAME[edit]

Hi there, when I try to include {{PAGENAME}} within <metadesc></metadesc> it does not parse it. Is there a way out?


Am i missing something else. On 1.17 PHP 5.3 i installed the extension and also enabled $wgEnableMetaDescriptionFunctions = true; however, using the parser {{#description2:meta description}} does not appear to do anything and in fact appears on the page as any text. Why is it showing up when it's a parser and why is it not working to set teh meta description. ANy help would be great.

Thanks Wikimanz 16:33, 23 October 2011 (UTC)

Link to the wiki please. Daniel Friesen (Dantman) 21:33, 23 October 2011 (UTC)

Never Mind, I apologize, downloaded and installed latest version from subversion and It works, perhaps I was dealing with an older version of this extension. Thanks for the extension and fast response.


I can't make it work![edit]

I've added the extension together with OpenGraphMeta some time ago and I think that it worked with Mediawiki 1.21, though I couldn't make the correct image to appear on Facebook.

It stopped working after an upgrade, I think. http://wikitranslate.org/wiki/Special:Version You can google the pages of the wiki to check! I'm not sure that I am doing it all correct! With many thanks for your work! Natkabrown (talk) 17:37, 15 February 2014 (UTC)

Thanks -- Working with 1.17[edit]

I got this extension to work properly with v1.17, but I had to download the "trunk" version, and go in and change the $wgEnableMetaDescriptionFunctions = true; inside the php code (it didn't seem to work properly if I just set it inside to true in LocalSetting.php). The website is http://wheretosee.org/wildlife/Main_Page

You shouldn't need to edit it at all. Did you make sure to set the $wg variable after your require_once line?
The REL1_17 code is a bit old yeah, it's 0.1.1 while the current is 0.2. We do need a better extension deployment system, most extension authors don't bother to update the versions of extensions in the old REL branches. The REL branches are mostly there for a guarantee of "This was what was around when this release was released, if you can't get the current version working, then this version has a better chance of being compatible." Daniel Friesen (Dantman) 19:22, 3 November 2011 (UTC)

Extra options[edit]

Hi I'm in the process of setting up a MediaWiki 1.16.5 WIP at www.financial-jargon.co.uk

Your extension is fantastic with auto descriptions but I couldn't get the override description to work I added $wgEnableMetaDescriptionFunctions = true; to localsettings.php as per the guidance However, the parser extensions (I've tried all 3) just show up as text on the page.

The only thing I can think of is that there as only an extension for 1.17.x and I'm using media wiki 1.16.5

Any help appreciated thank you

Did you make sure to download the trunk version of the extension and that the $wg was set after the require_once instead of before? Daniel Friesen (Dantman) 18:43, 10 November 2011 (UTC)


Thanks Daniel. The trunk version (vs. 1.17x) worked a treat. Many thanks for your help. Stuart 23:54 16 November 2011 (UTC)

Two Feature Requests[edit]

Description2 works great on our site on the first try. There are two minor improvements that would be nice.

  1. If the paragraph that becomes the description or the <metadesc> block contains an HTML entity like "&reg;", this becomes "&amp;reg;" in the description, which seems incorrect.
  2. If a <metadesc> block is placed on a line by itself, it behaves like an extra blank line from the wikitext perspective, adding extra vertical whitespace. So if I put a <metadesc> right after the first heading, I end up with extra space between the first heading and the first paragraph. It would be nice if I could add <metadesc> and maybe even a blank line before it, without affecting the final layout.

Ncrutcher (Nat) 03:13, 24 May 2012 (UTC)

Works perfectly with 1.19! Thank you so much![edit]

I'm so glad that I am finally able to edit my meta description. I tried so many other extensions that gave me horrible errors upon loading my site after installation. The worst thing is that some of them claimed to work with 1.19, yet failed miserably. This is the most teeth grinding I've done yet as a wiki webmaster. Oh well, thank you for this beautiful extension. Craig131 (talk) 07:06, 5 August 2012 (UTC)

<meta property="og:description" content="{{#description2:...

The "{{#description2:" prefix is not stripped out when the open graph header is created. --Hendrik Brummermann (talk) 17:04, 8 October 2012 (UTC)

Description2 operates on the parsed HTML, not the WikiText. And the parserfunction is supposed to replace the description entirely. So what you're describing sounds like you're using it wrong, not a bug. Daniel Friesen (Dantman) (talk) 17:56, 8 October 2012 (UTC)

SEO Optimization[edit]

Excellent Extension!!!! Been having some trouble getting seen on the search engines, this might do it. Greatly appreciated.

Automatic description for images[edit]

Hi, I can see that automatic descriptions are working incorrectly for files/images. Instead of the wikitext introduced when uploading the file, "no pages linking to this image" (this is my translation to English) is shown. Is it possible to fix this without explicitly introducing the meta-description tag?

Restriction to namespaces defined by $wgSitemapNamespaces if required[edit]

Would it be possible to make a slight enhancement so that meta description is generated only for the pages in the namespaces defined by $wgSitemapNamespaces if required (option).

Question: configuration of default description[edit]

Default description is take from the first paragraph of the page. I would like to override it in LocalSettings.php with different setting, for example {{PAGENAME}}, did not figure it out, any advice would be appreciated.

You can include a template in all pages, something along the line of <includeonly>{{#description2:{{PAGENAME}} }}</includeonly>.
P.S. Please sign next time, it helps to date the discussions --FFS Talk 14:22, 29 November 2016 (UTC)

It sucks at extracting description from pages[edit]

Really. I see from the code that it tries to find the first paragraph and use it for description, excluding tables first. But now that "we're supposed to use divs instead of tables because they're more responsive" this extension fails blatantly and usually pick a random word from the infobox template... This is specially true for the main page that use divs mainly...

It should grab the first paragraph that is top level in the article body (that is, not nested inside other divs or elements). I'll try to contribute a patch to fix this when I have a bit of time. --Ciencia Al Poder (talk) 08:31, 15 August 2017 (UTC)

Wouldn't it be better to have it depend on extension:TextExtracts for that? --FFS Talk 11:18, 15 August 2017 (UTC)
It would be a great addition, indeed, if it can detect the presence of the TextExtracts and use its api in this case. --Ciencia Al Poder (talk) 17:24, 15 August 2017 (UTC)

Get desecription from other page?[edit]

I'd like to add a feature to this, to fetch the description from another page. E.g. with a parser function like {{#getdescription:Page Name}}. What do you think? Sam Wilson 09:21, 2 November 2017 (UTC)

Description should be a phrase from the current page, or very similar to the current page. Search engines may penalize you if your description is way different than the contents of the current page. --Ciencia Al Poder (talk) 10:21, 2 November 2017 (UTC)
@Ciencia Al Poder: Oh, no sorry, I understand that (it's a good point), but I mean just displaying a page's description elsewhere in the wiki. For example, a list of page links could have their descriptions shown next to them. This wouldn't set the description for the page that uses {{#getdescription:}}. Sam Wilson 21:54, 2 November 2017 (UTC)
Ah, I misunderstood you. The description is stored in the page_props table IIRC so it should be relatively easy to do. --Ciencia Al Poder (talk) 22:11, 2 November 2017 (UTC)

Suggestion: Output to the wiki page the description marked with the tag[edit]

Currently using the tag or parser function to override the meta description outputs the passed text only in the HTML header and removes it from the body text.

But in many cases the desired meta text is also part of the page body. So it would be great to be able to use the tag and keep the text output in its location. Probably by an "echo" version of the parser function, or a parameter to the tag or an alternative tag altogether in addition to the existing one.

In this case it would be preferable to have the function work on the rendered result of the passed text rather than possibly output wikitext. (Is this possible or do parser functions work exclusively before that stage?)

--Ahmad Gharbeia أحمد غربية (talk) 21:53, 15 October 2018 (UTC)

Remove $wgEnableMetaDescriptionFunctions[edit]

What's the point of enabling this extension if not to use the parser function and/or extension tag it introduces? Today I wasted some time trying to figure out why the parser function was not working until finally I read about the $wgEnableMetaDescriptionFunctions option. What's the point of it? Just remove it, or at least set it to true by default. Great extension btw! Sophivorus (talk) 21:35, 28 June 2019 (UTC)

From reading the docu the extension should automatically generate the descriptions. Only if you set this parameter to true you will be able to override the automatic description generation by using the tag or parser function respectively. Since it apparently does not generate a description automatically one seemingly needs to enable the extra options to make use of the extension at all. I guess this is a bug, however I have updated the docu to save others some time. Cheers --[[kgh]] (talk) 21:49, 28 June 2019 (UTC)