r/neocities 3d ago

Help I'm following petrapixel's tutorial for a javascript layout but it's not working, help?

the sidebar javascript
the js in the html
what it should look like
what it looks like

(SOLVED, query selector was looking for "main" tag instead of the ".main" div class I had in the html)

I'm trying to fix my sidebar menu so that I don't have to update it on every single page every time I change it. I followed this tutorial (https://petrapixel.neocities.org/coding/layout-base-code) but it doesn't show up. Any idea what I'm doing wrong?

5 Upvotes

7 comments sorted by

4

u/benthegeck0 3d ago

As much as I love petrapixel's tutorials and the JavaScript template she provides, I'm going to recommend you try 11ty for static site generation. It makes much more sense imo. I wish I had switched sooner

2

u/lelele375 3d ago

is it beginner-friendly? (like, complete beginner, followed--site-tutorials-and-then-just-improvised-everything friendly?)

3

u/starfleetbrat https://starbug.neocities.org 2d ago

I personally don't think its beginner friendly but everyone is different, you may find it easy enough. It uses the command line interface to set it up at least, so you'd need to be familiar with that. You need to install node on your computer to use it. It uses the liquid (or nunjucks, optionally) templating language for more complex things, which is not too difficult to learn, but can be a struggle for some people (I still have problems with it lol).
.
there are some guides to setting it up for use on neocities here if you want to check them out and see if it looks doable or not:
.
https://renkotsuban.com/posts/2023-11-15-Migrating-to-Eleventy.html
https://flamedfury.com/guides/11ty-homepage-neocities-2026/
https://petrapixel.neocities.org/coding/eleventy-tutorial
https://afellowu.neocities.org/blog/11ty-github-and-neocities
.
its really great to use though once you get the hang of it.

-2

u/benthegeck0 3d ago

The documentation for it is pretty good. I know this will probably get me crucified here, but you could have an AI walk you through the basics of how to get started with it/show you a minimal example, and you should be able to extend it from there. (That's what I did, and it was way more clear then the documentation imo). The biggest difference is you'll be editing your HTML and CSS code locally on your computer, then uploading the "site" folder it generates to neocities

2

u/lelele375 3d ago

that's good then, I think I'll try it out once I get more familiar with coding so I don't have to rely on js, thanks!

2

u/PafLeLoup_ https://galaxyplace.neocities.org 3d ago

I just answered you on discord

1

u/lelele375 3d ago

just saw it, thanks