Thanks so much for being so patient and your explanation. I decided to start over and found out that it was all my fault and that the problem is the deployment process. When I look at the Sage documentation for deployment it is not clear to me what needs to be copied via FTP to the server and what is not needed for the production site. Here’s my summary:
Do NOT copy via FTP to production server:
- .cache-loader folder
- node_modules folder
- resources/assets folder
- all files in the root folder (.editorconfig, .eslintrc.js, .gitignore, CHANGELOG.md, CODE_OF_CONDUCT.md, composer.json, composer.lock, LICENSE.md, package.json, package-lock.json, phpcs.xml, README.md, yarn.lock)
DO copy via FTP to production server:
- app folder
- config folder
- dist folder
- resources folder but not the resources/assets subfolder
- vendor folder
This is what needs to be put in the deployment documentation or I suggest automating this process somehow via a new yarn command (for example yarn build:preparedeploy) which would create a new folder (for example deploy) and put all files that need to be copied via FTP to the production server in that folder. This is intended for people like me who deploy their website manually via FTP, use a shared hosting server, and can’t run composer install on the production server. What do you think?
This also fixes the problems with paths and using App::title() as there are no path issues if deployed properly.
I am not the first one who had a hard time - see How do you actually deploy the Sage theme to a Wordpress site?! - my summary should also be added to that topic thread but it’s already closed so I’ll leave that up to you. Ideally it should be in the documentation.