josephdyer/skeleventy

Cannot link between pages using VS Code Live Preview in browser

Closed this issue · 7 comments

Sorry, probably a newbie question, but when I view dist > index.html and then click on blog (for example) the browser throws an error message: Cannot GET /blog/

I've attempted to add a .htaccess file to dist folder with the following code (to address the issue):

`Options +ExecCGI +FollowSymLinks -MultiViews

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ /$1.html [L]`

Again, I'm unsure if this is the issue and whether it is the correct way to address it. I look forward to any guidance you may be able to provide. Thank you.

Hey, once you've ran npm run dev it will start a localhost server for you. It'll probably be port 8080 or something.

I have run dev but it’s looks like the links require dist/about... dist/blog etc

Does it matter where I store the files on my Mac? Development-wise I only have MAMP, but this install of Skeleventy isn’t inside MAMP/htdocs. Does that matter?

When you run npm run dev in terminal, do you get any errors?

No it doesn't matter where the website's folder is on your machine. In htdocs is fine

Have you tried opening a new browser tab and going to http://localhost:8080

Thank you so much - that works a treat. I was using the Live Server extension in VS Code - right clicking on dist/about/index.html - which probably explains why it wasn't allowing me to link to other pages.

Haha glad to hear! I will update the docs to inform people to use localhost to avoid confusion!

Live reload is also built in too, so you don't need to refresh when making changes to the templates files or any files within /resources (scss & js) ;)

Thank you again for your assistance! Yes, live reload built in - awesome :-)

One more question please, as I'm new to GitHub. Do you recommend my cloning or downloading your repo? I'm wondering how I take advantage of future updates you make etc, but also how cloning this would impact on my own website (ie whether it might break things if I've changed anything) once it's live.

No problem.

You can fork this repo and that'll create your own local copy, and then do a git pull to get the latest updates from the master - but if you've made changes to stuff on your local forked version, you'll end up with conflicts and will need to choose what you want to keep/override. It's a tricky one...