kiophen

Neocities tipz and trickz

Neocities is a great host for static web content. "Static" meaning you can't host any Dynamic content, which would be anything with server-side interactivity such as a forum, or anything that would require the server to process and/or store some kind of data from a user of your website.

However, there's still a lot you can do with just JavaScript. Here's some things that would normally be done with server-side coding.


Google Powered Guestbook

My guestbook appears to be serving dynamic content, since you can leave and read comments from people. There are widgets you can use that have allowed people to do this on their static sites since Geocities, but I wanted to make one myself.

I made a Google Form and Sheet, and use them as the submission and storage method. The page takes your form input (username, comment text), then submits a form with that info using them as URL parameters. The form is set up to send its submissions to a google sheet. There is also javascript on the page that loads the sheet as a .csv (comma seperated value), then formats it to display as comments on the page.

One other thing I implemented is having it send you to a "thank you for commenting" page after the comment is made.

It's not perfect, it does take a little while to load the comments, and I haven't implemented any pagination or way to handle the sheet if/when it becomes huge, but it works.


Updateable Sidebar

The sidebar to the left is not written into the .html file I am writing into right now. It's actually a script tag that loads a seperate .js file, which inserts some HTML wherever the script tag is. If I want to add new links to my sidebar, I don't need to update all my pages. I just need to update that .js file, and all my pages will load the updated sidebar.

This one is very easy to do. You just need to place your script tag into each page, into a container element if you need to, write the sidebar's HTML, then put it in the .js file. When you need to update, just edit the .js file.

You can write this HTML in the same way you would normally, with classes/styling/whatever. Document.write() will insert it into the page wherever the script is run.

If you run document.write() after the page is already loaded, it will erase the whole page.

Also, make sure to use grave accents ( ` on the ~ key ) instead of quotes in order to make a multi-line string.

This is the file I use to insert my sidebar links. I also use it to insert the "New" gelmew icons.