Building a static website fails without error message #351
-
I am evaluating Yellow and building a static version of my website is a 'must have'. Thus I have tried: php yellow.php build /var/www/html/website and at first it appears to work as I get the following response: Yellow build: 18 files, 0 errors It looks promising, but unfortunately the static site does not show when I point a browser at http://localhost/website/ and a directory listing for the static site looks like this: $ ls -l /var/www/html/website totalt 12 -rw-r--r-- 1 www-data www-data 1388 jul 30 18:02 404.html drwxr-xr-x 6 www-data www-data 4096 jul 30 18:04 media -rw-r--r-- 1 www-data www-data 118 jul 25 14:41 robots.txt I don't know exactly what should be in the directory, but I would expect an index.html. All lines containing the string "Static" in system/config/config.ini: StaticUrl: http://localhost/website/ StaticDefaultFile: index.html StaticErrorFile: 404.html StaticDir: cache/ I have tried to generate a static website on two servers:
I get no error message in /var/log/syslog. /Staffan |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
Thank you for the detailed bug report. Yes you're right. It looks like the build command didn't generate HTML files for a website in a subfolder. The location filter was the problem, it didn't take the subfolder into account. Should be working now. Can you please update your website and test if it works? |
Beta Was this translation helpful? Give feedback.
-
Thank you for your very quick response! The new version works better and the site in the /website/ directory now gets an index file and looks very similar to the one in /yellow-master/. However, I have discovered one problem: The links in the static version link back to the /yellow-master/ directory. This applies to both links to stylesheets and similar in <head> and to links in <body> so when you click on e.g. "Home" or "About", you end up going back to /yellow-master/ which won't work if the exported static site is on another machine. Below is a relevant snippet from index.html in the static directory: |
Beta Was this translation helpful? Give feedback.
-
What's the target URL of your static website (real or imaginary)? |
Beta Was this translation helpful? Give feedback.
-
Ideally I'd like to be able to set the target URL to anything, depending on the circumstances. For testing, I simply used "http://localhost/website/" instead of "http://localhost/yellow-master/", but what I really want to do is to develop the site on my local machine and then export it to an external web hosting service. I expected that the line "StaticUrl: http://localhost/website/" in system/config/config.ini would define the target URL. The reasons for this scenario are:
I have not tested on an external server yet, but I will if I have reason to expect that it might work. |
Beta Was this translation helpful? Give feedback.
-
Yes, that's how it works... First you set |
Beta Was this translation helpful? Give feedback.
-
Well, that's how I was hoping that it would work, but unfortunately the URL that I set in system/config/config.ini wasn't reflected in the files that were written to the static site. Instead the links point back to the original site (under /yellow-master/). For example, in /var/www/html/website/index.html, the link to the stylesheet should be: I guess that I could work around it by piping the output through sed in an export script, replacing all occurrences of "/yellow-master/" with "/website/", but that wouldn't be ideal. Have you been able to verify that links are inserted correctly on your machine? If so, could it be that something went wrong when I upgraded to the new version of Yellow? Should I rip everything out and do a fresh install from scratch? |
Beta Was this translation helpful? Give feedback.
-
It works on my machine and links are generated correctly. Not sure what's the best way to narrow down the problem. Can you give me shell access? |
Beta Was this translation helpful? Give feedback.
-
I think the path problem must have been related to upgrading Yellow (it was the first time I tried to upgrade, I only discovered Yellow yesterday). I have now spun up a new virtual machine, downloaded and installed a fresh copy of Yellow, made some minor changes and exported to a static website. And it worked! I'll do some more testing after adding some content and doing some tweaking, but for now it seems that the problem has been solved. Thank you! |
Beta Was this translation helpful? Give feedback.
-
I have now done some more testing and it all works on the newly installed virtual server. Perhaps the problem was related to the upgrade, some old stuff in the cache, or something else... Anyway, it seems to work as expected now, so thanks a lot for fixing the problem so quickly! |
Beta Was this translation helpful? Give feedback.
-
Good to hear. Feedback and bug reports are always welcome. |
Beta Was this translation helpful? Give feedback.
Thank you for the detailed bug report.
Yes you're right. It looks like the build command didn't generate HTML files for a website in a subfolder. The location filter was the problem, it didn't take the subfolder into account. Should be working now. Can you please update your website and test if it works?