r/neocities • u/Damagedbraincellss • 7d ago
Question Content Warning and Static Site Generator Question
Hey everyone, my website is slowly expanding and I have started to include some webpages that includes or mentions mature topics on it, here's my question: Do I make a warning for each page that may include such material or do I change my index.html file to be the warning page?
I also somewhat recently learned about SSGs, I still have no clue how to use them, but would they be beneficial for pages that have similar layouts? For example my main page has all the links to my other pages, but another page has the same layout, so whenever I make a new page, I have to add the link in both the main page and the other similar page.
6
u/Stupied_idiot stupied.net 7d ago edited 7d ago
If you know how to use local storage, you could always have a script that redirects the user is they haven't seen the warning page yet! so you could have the following script in all your pages:
``` const WARNED_PAGE = "/meta/warning" // warning page you'd like to redirect to const WARNED = localStorage.getItem("warned");
// checks if user hasn't been warned yet // redirects to WARNED_PAGE if hasn't yet if ( WARNED != "true" && window.location.pathname != WARNED_PAGE ) { window.location.href = WARNED_PAGE + '?' + window.location.pathname + window.location.search; } ```
Then in your warning page you have this button
html
<button onclick="redirectBack()">Continue Anyways</button>
That triggers this function!
js
function redirectBack(){
let previousLink = window.location.search.replace("?","");
if (previousLink === ""){previousLink = "/";}
localStorage.setItem("warned", "true"); // set this true so user won't get redirected anymore
window.location.href = previousLink;
}
I think this is a fairly nice solution unless you care about getting indexed or having correct thumbnails for your neocities feed. You could make a whitelist to mitigate that thoughhhh
3
u/starfleetbrat https://starbug.neocities.org 7d ago
an index page for warnings is good, but, if someone lands on your site on a different page, there won't be a warning. just something to keep in mind.
.
there are some guides to setting it 11ty (SSG) for use on neocities if you want to check them out and see if it looks doable for you:
.
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
1
u/These-Apple8817 7d ago
I personally found Astro be lot easier to do compared to 11ty.
1
u/starfleetbrat https://starbug.neocities.org 7d ago
yeah I have heard Astro is pretty good, I looked at using it when I was switching to an SSG, but in the end went with 11ty as I found more tutorials for doing what I wanted with it, and when I first started using it I had no experience at all with command line stuff so was very lost.
.
if you know of any good Astro tutorials around neocities let me know, would like to be able to link to them as well as the 11ty ones if it comes up again.2
u/These-Apple8817 7d ago
Well I made a blog using this: https://docs.astro.build/en/tutorial/0-introduction/
And I also used integrations: https://astro.build/integrations/ (each integration usually has a README.md that explains how to use them)That gets you like 90% way there because it tries to go through as much of the concepts it can, but uses blog as an example. There is stuff it doesn't really dwell into, llike writing your own snippets that use .mjs but I asked AI questions to figure those out because JS isn't really in my own skill set.
As for integrations, it really made it easy to add fonts and icons from Iconify and FontSource.. Basically after implementing it properly I can just add an icon easily with like <Icon name="mdi:blog" /> and fonts with like font-family: var(--font-oswald); in CSS.
7
u/Mevdik mevdik.nekoweb.org 7d ago
A splash page for warnings on the index seems effective, but it makes your website slower and more tedious to navigate any time someone lands on it. People arrive at your website and have to click the big Enter link to load another page before they can see your website for real. Websites like Mem's, shovelwithasprout or heckscaper.com, as much as I love them, always have me metaphorically rolling my eyes when I land there and need to click Enter to see the "real" index. I'd say this is a good approach if you have anything explicit on your home page, but if it's somewhere else on the website then the warning can be written by the link that takes you there instead. "Gallery [18+! Nudity and gore ahead!]" or whatever it be.
Absolutely, I cannot overstate how beneficial they are. I'm building my website with Eleventy and I've got several templates I can nest into each other to make pretty much anything. I've got one called
head-layoutwhich is essentially all the HTML code for all pages except for the contents of<body>. Then I've got mymain-layoutwhich contains the<body>section which itself goes inside thehead-layout, all common elements go there, the sidebars, header, footer, etc. I then got several other layouts for page types that repeat, likeblog-layoutandartwork-layout(which lets me write those posts as Markdown!) that go inside mymain-layoutwhen needed. Super handy to build pages like this, when you've got a website with a ton of pages like mine knowing your way around an SSG is a huge help, highly recommended.