Open Bronislawsky opened 4 years ago
@Bronislawsky It is something that I've thought about since the beginning, however I'm not sure what the best approach would be. Obviously yes, including every single common URI slug in dozens of languages by default would not be very manageable.
So yah, probably it would need a variable in ss-config
for custom slugs to skip cache.
That said, I'd also love to be able to popularize certain URIs (spellings) for commonality/SEO... I'm not a fan of needlessly complex slugs like shopping-cart
instead of just cart
etc.
suggestion: ask about language in the installer script and link it to a file in your repository. everybody who needs a language should contribute the file with the correct translations. Workaround for not yet accepted contributions: set own URL or path to language files in the ss-config
example file: "de_DE.txt"
cart="warenkorb" account="mein-konto" checkout="checkout" contact="kontakt" .....
this is just an example, i don't have the correct slugs in my head right now.
another, easier, way would be to set the initial exclusions in english, then get the current values of woocommerce on each ss-update. this way the user would not need to install everything a second time after reading his config and writing the file. but i guess this would involve more coding
In french, we use panier instead of cart etc,
Is it a possibility to eventually add multilang support or a custom skip cache options for other language than English ?
can you please insert the correct values here @Bronislawsky and i will add them to my fork. they may get pulled to this repo
## FRENCH - sensitive wordpress urls should always skip the cache
if ($request_uri ~* "index.php|/account.*|/cart.*|/checkout.*|/contact.*|/dashboard.*|/login.*|/my-.*|/order.*|/profile.*|/register.*|/settings.*|/view.*|/wc-api.*|/wp-admin.*|wp-.*.php") {
set $skip_cache 1;
}
As an aside, I mentioned this on the Pull Request but to begin considering support for 100 languages we should probably move the skip cache rules into a new Nginx module instead like:
/etc/nginx/conf.d/skip-cache.conf
... or something where users only install the skip cache rules for one language.
I don't know yet how to implement, but here's an example file:
https://github.com/littlebizzy/slickstack/blob/master/modules/nginx/languages/en_us.txt
By separating files like this, it makes it easier for users to contribute spelling fixes and other patches. And, it means each SlickStack server only needs to install the languages that they will use.
New location:
https://github.com/littlebizzy/slickstack/blob/master/languages/en_us.txt
## notes for future: hardcoding nginx skip cache rules per each language is too limiting...
## we probably need centralized language files like WordPress Core does, to be used for whatever purposes
## need to decide on a format and how to extract various terms
Some general links to review best practices in WooCommerce skip cache rules... putting this here, because it probably doesn't need a separate issue:
Ref: https://github.com/EasyEngine/easyengine/issues/621 Ref: https://gist.github.com/pelmered/616efcde63c17a4dc3cd Ref: https://spinupwp.com/wordpress-static-site-nginx-page-caching/
In french, we use panier instead of cart etc,
Is it a possibility to eventually add multilang support or a custom skip cache options for other language than English ?