Giter Club home page Giter Club logo

Comments (6)

distantnative avatar distantnative commented on August 15, 2024 1

The salt by default contains the parent's page ID which includes the sorting number. If you resort the parent, the page sorting number changes, the page ID changes, the salt for contentToken changes and in the end that's why the root for the media file changes => it gets newly created.

from kirby.

distantnative avatar distantnative commented on August 15, 2024 1

@ovenum this will be fixed/improved in Kirby 5 (instead using the absolute root for the hash, we're using the root to the content folder and then only the ID without sorting numbers).

#6432

from kirby.

distantnative avatar distantnative commented on August 15, 2024

@ovenum are you already using https://getkirby.com/docs/reference/system/options/content#salt-for-drafts-and-media-files as suggested on Discord to not use the page ID (which includes the sorting number) in the path?

This might not fully work as I realize that the file's mediaRoot also includes $parent->mediaRoot() (the page), which includes its id (incl. sorting number) as well: https://github.com/getkirby/kirby/blob/main/src/Cms/Page.php#L798

I haven't spotted in our code where we would use the modification timestamp of the page in the file's url. Are you sure about this? It does in fact use the modification of the file itself which is necessary as otherwise browser would not load new versions of a file that gets updated/replaced with the same name.

from kirby.

ovenum avatar ovenum commented on August 15, 2024

@distantnative i have not used the config option for content salts.
Testing with a kirby plainkit, setting content.salt to a fixed value will solve the issue.

// site/config.php
return [
'content' => [ 'salt' => 'test' ]
]

When not setting the content salt i can reproduce the issue every time with the plainkit.
Also not sure what the root of the issue is. I could see that the modified timestamp of the folder changed and that it’s contained within the file path, so just assumed it might be the cause.

from kirby.

ovenum avatar ovenum commented on August 15, 2024

Thanks for explaing this! Understanding now why this is happening. I would consider it a bug or at least a not optimal default setting.

The images do not need to be re-created because their path or content did not change when just the parents sorting number is modified/added.

As mentioned on Discord this can cause unecessary server load and hdd usage when pages sorting numbers are changed.

from kirby.

ovenum avatar ovenum commented on August 15, 2024

Thanks @distantnative this really helps a lot!

Also noticed that this can cause Google to create duplicate content hints when a page contains PDFs that were added to the search index and now got a new url because of changing the sort order and not clearing pages media folder.

from kirby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.