New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Add ability to rename asset filename from CP #699

Closed
lesaff opened this Issue May 19, 2016 · 2 comments

Comments

Projects
None yet
5 participants
@lesaff

lesaff commented May 19, 2016

This is a nice-to-have function, especially for clients.

@ericwenger

This comment has been minimized.

ericwenger commented Oct 25, 2016

When the SEO team goes through the site, it would be a lot easier for them to rename the files than download them (which isn't easy to do right now either) and re-upload and re-reference. Good feature to add.

@peda

This comment has been minimized.

peda commented Dec 19, 2016

@ericwenger I found a way to "hack" this feature at least for all images generated using Glide

  1. I've created an addon (https://github.com/peda/statamic-glide-vanity-url) to include the filename in Glide URLs
  2. create a custom fieldset called "asset" - like the following one:
title: Asset
hide: true
fields:
  title:
    display: Title
    type: text
    instructions: The display name of the asset.
  alt:
    display: Alt Text
    type: text
    instructions: An alternate name for accessibility.
  filename:
    type: text
    display: Filename
    instructions: null
  1. Just change the file GlideVanityUrlBuilder (from my addon) to use the field filename instead of basename()

I'm outputting every image with glide (as it can also be called without any modification parameters), so I can always show the image name I want to have. By putting the filename inside a grid or replicator together with a locale field (i.e. select) you could even localize it. The current locale can always be referenced by $GLOBALS['locale']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment