austintoddj / canvas

Publishing on your own terms
http://trycanvas.app
MIT License
3.27k stars 521 forks source link

SEO improvement: change rename image file #1040

Open Programmatore-Web opened 2 years ago

Programmatore-Web commented 2 years ago

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

austintoddj commented 2 years ago

The UploadsController handles storing images.

How does your proposition improve SEO?

Programmatore-Web commented 2 years ago

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.

austintoddj commented 2 years ago

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

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

Programmatore-Web commented 2 years ago

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 commented 2 years ago

Search Engine Optimization (SEO) Starter Guide

Immagine 2022-06-19 114037

austintoddj commented 2 years ago

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

Pushkraj19 commented 3 weeks ago

1441 I have added it.