Comments (6)
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.
@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).
from kirby.
@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.
@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.
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.
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)
- Image thumbs: persisting jobs files HOT 5
- [Panel] Dragging a file from a file section into a writer field stores the panel file url HOT 1
- [Panel] Long page title pushes the prev/next page navigation out of view HOT 3
- Resize/crop/thumb functions see longest size of images as width HOT 5
- [Panel] Switching Languages triggers revert / save HOT 1
- Use `slugs.maxlength` when generating slugs HOT 1
- `convert` command deprecated
- Slower navigation requests still go through even if already navigated elsewhere
- Files & Pages field: singular empty text when multiple: false HOT 2
- Media file not deleted after status change HOT 1
- Table layout pages section: interactive previews are not updating content HOT 1
- [Panel] Pattern setting is ignored in some cases HOT 4
- Classes added by Custom Nodes are stripped out of the Writer field when refreshing the page/ProseMirror re-rendering the Writer HOT 2
- Performance issue: slow pages section with table layout
- Sorting doesn't work as expected if some pages have fixed nums HOT 5
- Page creation dialogue: "add" button is no longer displayed [regression] HOT 1
- IDE support for `Filesystem\Asset` proxied methods HOT 2
- Focus on Blocks is not removed when focus switches to other field
- Change URL dialog: not displaying language URL prefix
- `Html::tag` does not accept whitespace for attributes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kirby.