User talk:Kirk: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 76: | Line 76: | ||
|image=Uploaded_file.png | |image=Uploaded_file.png | ||
|image_alt=Wiki Logo | |image_alt=Wiki Logo | ||
}} | |||
</pre> | |||
<pre> | |||
{{#seo: | |||
|title= | |||
|keywords= | |||
|description= | |||
|image= | |||
|image_width= | |||
|image_height | |||
|type= | |||
}} | }} | ||
</pre> | </pre> |
Latest revision as of 12:56, 24 July 2020
SEO Usage
The extension can be used via the {{#seo}}
parser function. It accepts the following named parameters in any order.
title
- The title you want to appear in the html title tag
title_mode
- Set to append, prepend, or replace (default) to define how the title will be amended.
title_separator
- The separator in case titlemode was set to append or prepend; " - " (default)
keywords
- A comma separated list of keywords for the meta keywords tag
description
- A text description for the meta description tag
robots
- Controls the behavior of search engine crawling and indexing
googlebot
- Controls the behavior of the google crawler
hreflang_xx-xx
- Adds
<link rel="alternate" href="url" hreflang="xx-xx">
elements
- tags related to the Open Graph protocol
type
- The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required.
image
- An image URL which should represent your object within the graph.
The extension will automatically add the right image url, width and height if an image name is set as the parameter. Exampleimage = Local_file_to_use.png
.
Alternatively a full url to an image can be used,image_width
andimage_height
will then have to be set manually.
If no parameter is set, the extension will use$wgLogo
as a fallback or the local file set through$wgWikiSeoDefaultImage
.
image_width
- The image width in px. (Automatically set if an image name is set in
image
)
image_height
- The image height in px. (Automatically set if an image name is set in
image
)
image_alt
- Alternative description for the image.
locale
- The locale these tags are marked up in. Of the format language_TERRITORY.
site_name
- If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb".
- tags related to Open Graph type "article"
author
- Writers of the article.
keywords
- Translates into
article:tag
section
- A high-level section name. E.g. Technology
published_time
- When the article was first published. ISO 8601 Format.
- tags related to Twitter Cards (see OpenGraph Tags)
twitter_site
- If you did not set a global site name through
$wgTwitterSiteHandle
, you can set a site handle per page. If a global site handle is set this key will be ignored.
Examples
Adding static values
{{#seo: |title=Your page title |title_mode=append |keywords=these,are,your,keywords |description=Your meta description |image=Uploaded_file.png |image_alt=Wiki Logo }}
{{#seo: |title= |keywords= |description= |image= |image_width= |image_height |type= }}
Adding dynamic values
If you need to include variables or templates you should use the parser function to ensure they are properly parsed. This allows you to use Cargo or Semantic MediaWiki, with Page Forms, for data entry, or for programmatic creation of a page title from existing variables or content...
{{#seo: |title={{#if: {{{page_title|}}} | {{{page_title}}} | Welcome to WikiSEO}} |title_mode={{{title_mode|}}} |keywords={{{keywords|}}} |description={{{description|}}} |published_time={{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}} }}
Hreflang Attributes
{{#seo: |hreflang_de-de=https://example.de/page |hreflang_nl-nl=https://example.nl/page-nl |hreflang_en-us=https://website.com/ }}
Will generate the following `<link>` elements:
<link rel="alternate" href="https://example.de/page" hreflang="de-de"> <link rel="alternate" href="https://example.nl/page-nl" hreflang="nl-nl"> <link rel="alternate" href="https://website.com/" hreflang="en-us">
--D (talk) 13:48, 23 July 2020 (MDT)
Robots links
https://developers.google.com/search/reference/robots_meta_tag