canvas icon indicating copy to clipboard operation
canvas copied to clipboard

SEO improvement: change rename image file

Open Programmatore-Web opened this issue 4 years ago • 7 comments

Is your feature request related to a problem? Please describe.

SEO improvement: change rename image file.

Describe the solution you'd like

I propose to replace the renaming of the image files like this: original-name-random-number.extension. Can anyone tell me where to look in the files? Thanks.

Describe alternatives you've considered

No response

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.

Programmatore-Web avatar Apr 10 '22 09:04 Programmatore-Web

The UploadsController handles storing images.

How does your proposition improve SEO?

austintoddj avatar Apr 10 '22 15:04 austintoddj

SEO specialists argue that the filename must match the keyword. Then: original-name = keyword random-number = avoid replacing an existing file.

A better solution would be: title-post / keyword.ext.

Programmatore-Web avatar Apr 10 '22 16:04 Programmatore-Web

Thanks for the suggestion. Drop any links here that support that hypothesis.

I'll see about adding this to the v7 features.

austintoddj avatar Apr 10 '22 18:04 austintoddj

I tried this solution.

    public function store()
    {
        $payload = request()->file();

        if (! $payload) {
            return response()->json(null, 400);
        }

        // Only grab the first element because single file uploads
        // are not supported at this time
        $file = reset($payload);

        $name = time() . '-' . $file->getClientOriginalName();

        //$path = $file->storePublicly(Canvas::baseStoragePath(), [
        //    'disk' => config('canvas.storage_disk'),
        //]);

        $path = $file->storeAs(Canvas::baseStoragePath(), $name);

        return Storage::disk(config('canvas.storage_disk'))->url($path);
    }

Programmatore-Web avatar Apr 13 '22 09:04 Programmatore-Web

Thanks for that @ServizioWebmaster. I'll get this addition in the next major release.

austintoddj avatar Jun 27 '22 13:06 austintoddj