• Resolved ratamatcat

    (@ratamatcat)


    Is it OK to use a number in a media library title to distinguish media items.

    Throughout my body of work there might be seven drawings (figures) of very similar subjects.

    Sailing ship five mast ovoid sail
    Sailing ship four mast sloping sail
    Sailing ship four mast separated sail
    Sailing ship four mast short sail
    Sailing ship five mast uneven sail
    Sailing ship four mast triangular sail
    Sailing ship three mast pointy sail

    But it can become challenging using descriptors to differentiate the different figures, and it’s possible another ‘Sailing ship five mast ovoid sail’ could come along.

    So I thought about using a reference for the page which the figure belongs to, for example the first one in the list above belongs to page ‘0080’, a scan of line art which also contains other unrelated drawings:

    Sailing ship five mast 0080-1

    If there’s another sailing ship on the same page:

    Sailing ship five mast 0080-2

    If there’s a sailing ship on a different page:

    Sailing ship five mast 0127-1

    This would seem better as I can use a shorter name then the number. My file names are the same so I would still use a reasonable number of descriptive words for SEO, but would not have the job of absolutely distinguishing the figures apart.

    All this stems from the fact I thought that there should not be two or more media library titles with an identical name.

    I wanted to avoid number identifiers originally to avoid general uncertainty with diverging away from pure text. For example I make use of the attachment page and the media title is displayed there too, which would also display numbers if I use this method. This makes it read a bit technical and doesn’t seem ideal, but maybe it’s in fact alright.

    Would using the numbers detract in any way or cause a problem?

    Thanks,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for the question and the details on your application ideas; very helpful.

    The short answer is yes, it’s fine to use numbers (and special characters) in the Media Library Title value. The numbers can be part of the original file name, added to image metadata before uploading (see the “WordPress default title, slug and description mapping” section in the Documentation tab), added in an MLA mapping rule or added manually after the item is uploaded.

    Your specific question is about the Title, but you should be aware of two other values to make sure everything ends up as you want it. There is a distinction between the Title and the Name (or Slug) values. The Title can be anything and does not have to be unique. The Name becomes part of the item’s Permalink and must be unique within the entire Media Library. To construct the name, WordPress takes the Title it generates, “sanitizes” it (converting spaces to dashes, lowercasing, etc.) and makes it unique (adding a numeric suffix if necessary). This takes place before MLA mapping rules are run.

    WordPress also modifies the original file name before saving the file in the Uploads area, changing spaces to dashes and adding a suffix if necessary to make it unique within the file directory where it is stored.

    I hope that gives you what you need to complete your application. I am marking this topic resolved, but please update it if you have problems or further questions regarding my explanation. Thanks for your long-time interest in MLA.

    Thread Starter ratamatcat

    (@ratamatcat)

    Hi David and thanks for your overview and confirmation. I realize now the number system is the superior approach as it lets me adopt a systematic and faster naming method in comparison to the text-only names.

    My MLA Gallery is configured to use the metadata title (added by me before uploading) for the media library title.

    You mention that the media library title can be anything but as it’s used to generate the permalink, which does have to be unique in the system, to me it makes sense then to have a unique name for each media item which is identical for the below:

    • File name
    • Metadata title (of the above file)
    • Media library title
    • Permalink

    Otherwise WordPress will start adding number suffixes to my files and the media library titles and start confusing the hell out of me. In fact I’ve already seen some of this in my various uploads and testing.

    For example if I had a series of images I named the same with a number appended here’s what the slug looks like

    MEDIA LIBRARY TITLE | PERMALINK

    • Snow leopard 1 | snow-leopard-1
    • Snow leopard 2 | snow-leopard-2-2
    • Snow leopard 3 | snow-leopard-3-2

    Things go sideways fast! I might do this for the same design in a series of different colorways for example, or some other variation where it’s hard to add more name text.

    In summary now I am going to use:

    FILE NAME: sailing-ship-five-mast-u0080.jpg
    METADATA TITLE: Sailing ship five mast U0080
    MEDIA LIBRARY TITLE: Sailing ship five mast U0080
    PERMALINK: sailing-ship-five-mast-u0080

    The ‘U’ refers to the source page the figure comes from, 0080. I don’t have to use a character but visually I think it creates a continuity with the text of the title and looks better. Also without it, users may perceive this is image ‘No. 0080’ but it’s not – it’s simply a reference. The ‘U’ is chosen for pleasing proportions.

    If there is a second figure on the same source page which has an identical name:

    METADATA TITLE: Sailing ship five mast U0080F2

    If I create is a series of the same design that do not warrant a file name revision, i.e. using color variations or other minor edits:

    METADATA TITLE: Sailing ship five mast 2-U0080

    Based on this convention, I test uploaded the below randoms and thankfully did not experience the numeric suffix affliction as in the snow leopard example above. Each slug is exactly as the media title.

    • Sailing ship five mast U0365
    • Sailing ship five mast U0127
    • Sailing ship five mast U0080F3
    • Sailing ship five mast U0080F2
    • Sailing ship five mast U0080F
    • Sailing ship five mast U0080
    • Sailing ship five mast 3-U0080
    • Sailing ship five mast 2-U0080
    • Sailing ship five mast 1-U0080

    I wonder why this is because in the snow leopard I have identical filename text followed by (different) numbers. But it left the above uploads alone.

    Thanks,

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and the additional details on your application.

    You wrote “You mention that the media library title can be anything but as it’s used to generate the permalink, which does have to be unique in the system“. To clarify, the Title does not have to be unique; WordPress will add a numeric suffix to it to make the Name unique for the site and permalink.

    You wrote “My MLA Gallery is configured to use the metadata title (added by me before uploading) for the media library title.” Depending on what you mean by “configured to use” the name generation process will be different. If your “metadata title” is in one of the fields WordPress uses to generate the Title value, it will also be used to generate the Name value. If your metadata title is in some other field and you use an MLA mapping rule to copy it to the Title field, that happens after the Name field is generated from the file name or one of the fields WordPress uses. The “WordPress default title, slug and description mapping” section of the Settings/Media Library Assistant Documentation tab tells you which metadata fields WordPress uses for this puropose.

    You wrote “Otherwise WordPress will start adding number suffixes to my files and the media library titles“. WordPress adds number suffixes to the file name and to the media library Name (slug), never the Title. The suffixes may be different; the file name must be unqiue within the directory and the name must be unique site-wide. If you divide your Uploads area by year and month, then add the same file name in different months no suffix is required. Yes, it can be confusing.

    I cannot reproduce your Snow Leopard example on my system, but it may be that more than one “Snow leopard 2” item exists. You can try using the Media/Assistant Search Media feature with just the Name checked; look for “snow leopard” or just “leopard” and see what comes back.

    In any case your naming convention looks like a good solution. Thanks for sharing all this information with the MLA community.

    Thread Starter ratamatcat

    (@ratamatcat)

    To clarify, the Title does not have to be unique; WordPress will add a numeric suffix to it to make the Name unique for the site and permalink.

    Does that mean I could have:

    TITLE | NAME

    Sailing ship five mast U0080 | sailing-ship-five-mast-u0080
    Sailing ship five mast U0080 | sailing-ship-five-mast-blue-u0080
    Sailing ship five mast U0080 | sailing-ship-five-mast-gold-u0080

    Depending on what you mean by “configured to use” the name generation process will be different. If your “metadata title” is in one of the fields WordPress uses to generate the Title value, it will also be used to generate the Name value. If your metadata title is in some other field and you use an MLA mapping rule to copy it to the Title field, that happens after the Name field is generated from the file name or one of the fields WordPress uses. The “WordPress default title, slug and description mapping” section of the Settings/Media Library Assistant Documentation tab tells you which metadata fields WordPress uses for this puropose.

    WordPress for me automatically takes the value I have in the IPTC ‘Title’ field I put using Adobe Bridge for the file, on upload, and uses it for the media library title. If this is empty it automatically uses the image filename. Given now I am wanting to use my file name also as my media title I could simply leave the metadata title field empty but I read a file should ideally have this metadata so I will copy the filename into the metadata as an extra step. I think the metadata is known as IPTC 2#005 “object-name” from the MLA documentation you put above.

    WordPress adds number suffixes to the file name and to the media library Name (slug), never the Title. The suffixes may be different; the file name must be unqiue within the directory and the name must be unique site-wide. If you divide your Uploads area by year and month, then add the same file name in different months no suffix is required. Yes, it can be confusing.

    So if I wanted I could have the same media title for a series of images and on upload let WordPress add suffixes to differentiate the slugs and filenames for me? It could be an issue as I notice when selecting a media item for various reasons (say a custom field choice) the title value is used and therefore presents the items all as the same title and I can’t tell which is which.

    As you mention it’s perfectly fine to have same file names as long as they are in different months folders?

    I cannot reproduce your Snow Leopard example on my system, but it may be that more than one “Snow leopard 2” item exists. You can try using the Media/Assistant Search Media feature with just the Name checked; look for “snow leopard” or just “leopard” and see what comes back.

    Unfortunately for me I couldn’t confirm as I previously deleted the files I tested with. I have a feeling you’re right! This is good to know as those added suffixes seemed anomalous.

    In any case your naming convention looks like a good solution.

    Great!

    I am probably going to aim for unique names for each media that match up across file name, title and slug.

    Cheers,

    Plugin Author David Lingren

    (@dglingren)

    You wrote:

    Does that mean I could have:

    TITLE | NAME

    Sailing ship five mast U0080 | sailing-ship-five-mast-u0080
    Sailing ship five mast U0080 | sailing-ship-five-mast-blue-u0080
    Sailing ship five mast U0080 | sailing-ship-five-mast-gold-u0080

    Yes, but you would have to code the unique names in the IPTC Title field or the file name and then replace the Title values after WordPress generates the Name values. You could do that manually or put the non-unique values in some other IPTC field and use an MLA mapping rule to copy them to the Title. MLA mapping happens after the Name is generated.

    You wrote: “So if I wanted I could have the same media title for a series of images and on upload let WordPress add suffixes to differentiate the slugs and filenames for me?”

    Yes, but remember that the suffix generation is separate for the slug and the filename. If the IPTC 2#005 value is the same but the file names are unique only the slug will have a suffix applied. Having the same file name for several images would be very hard to manage; the file name suffixes usually come from uploading the same file multiple times.

    You wrote: “As you mention it’s perfectly fine to have same file names as long as they are in different months folders?

    Yes, but why would you want to do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Numbers in media Title for a unique reference’ is closed to new replies.