這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Slug for attached posts by image galleries

外掛說明

Slug4apig (Slug for attached posts from image galleries) is probably the simplest plugin ever seen, though of
imperative need for the WordPress community.

This plugin just adds a field to each image inserted through the WordPress built-in gallery interface. As easy as you edit
the name, description, etc. for each image, with Slug4apig you will be able to edit the friendly URL (aka slug)
and set the desired value.

By default, the WordPress built-in gallery will set the attachment post’s slug to the name of the image you inserted in
the gallery (minus .extension). This is a rather restrictive approach, as your images may have sequencial names
assigned automatically by the photo camera, like “S4100001.JPG”.

In the previous example, an autocreated attachment post would be created under the hypothetical URL:

http://example.com/2011/03/post-title/S4100001/

and a search on, i.e. Google, will show “S4100001” as the title for the page, which is senseless for the search
engine users, robots, and SEO activities in general. Suppose the image is from a bike; then you will like the URL
to be relevant, like:

http://example.com/2011/03/post-title/bike/

wich is SEO friendly. There is no magic, you just set the attachment post name to overwrite the default with the name
of your choice!

Remember to use valid, unreserved characters for the slug. Characters that are allowed in an URI but do not have a
reserved purpose are called unreserved. These include uppercase and lowercase letters, decimal digits, hyphen, period,
underscore, and tilde.

Future enhancements

  • Slug name validation
  • Batch jobs support

安裝方式

Slug4apig is probably the simplest plugin ever seen. No configuration, nor code insertion is needed:

  1. Upload Slug4apig.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

And that’s it!

常見問題集

What slug name do I give to my images?

Any relevant one, as long as it uses valid, unreserved ASCII characters: {[a-z], [A-Z], [0-9], -, _, ., ~} or,
textually {uppercase and lowercase ASCII letters, decimal digits, hyphen, period, underscore, and tilde}. Special
characters like ñ, ü, and the like, will rise problems.

For the time being, no check is performed on the slug name chosen by the user.

Why should I give a slug name to all my images?

As stated by the Clean URL Wikipedia article,
there is aesthetic, usability and search engine optimization (SEO) purposes, as long as some other considerations.

使用者評論

這個外掛目前沒有任何使用者評論。

參與者及開發者

以下人員參與了開源軟體〈Slug for attached posts by image galleries〉的開發相關工作。

參與者