diff --git a/html/about.html b/html/about.html new file mode 100644 index 0000000..b9a9c9c --- /dev/null +++ b/html/about.html @@ -0,0 +1,23 @@ + + + + About Zonelets + + + + + + +
+ +
+ +

About

+

[Under Construction!]

+ +
+ +
+ + + \ No newline at end of file diff --git a/html/archive.html b/html/archive.html new file mode 100644 index 0000000..c37da00 --- /dev/null +++ b/html/archive.html @@ -0,0 +1,25 @@ + + + + Zonelets Archive + + + + + + + + +
+ +
+

Zonelets Archive

+
+
+ +
+ + + + + \ No newline at end of file diff --git a/html/images/bg_diamond.png b/html/images/bg_diamond.png new file mode 100644 index 0000000..d33860d Binary files /dev/null and b/html/images/bg_diamond.png differ diff --git a/html/images/favicon.png b/html/images/favicon.png new file mode 100644 index 0000000..377d0c6 Binary files /dev/null and b/html/images/favicon.png differ diff --git a/html/images/lake.jpg b/html/images/lake.jpg new file mode 100644 index 0000000..3a64277 Binary files /dev/null and b/html/images/lake.jpg differ diff --git a/html/index.html b/html/index.html new file mode 100644 index 0000000..320a8c2 --- /dev/null +++ b/html/index.html @@ -0,0 +1,34 @@ + + + + My Blog's Homepage + + + + + + + + + + + +
+ +
+ + +

Welcome to my blog!

+ +

I hope you enjoy your time here!

+ + +
+ +
+ +
+ + + + \ No newline at end of file diff --git a/html/not_found.html b/html/not_found.html new file mode 100644 index 0000000..b27d820 --- /dev/null +++ b/html/not_found.html @@ -0,0 +1,28 @@ + + + + + Page Not Found + + + + + + + + + + +
+ + +
+

Page Not Found

+ +

The requested web page was not found on this site. Rats!

+
+ +
+ + + \ No newline at end of file diff --git a/html/posts/2020-11-10-HTML-cheat-sheet.html b/html/posts/2020-11-10-HTML-cheat-sheet.html new file mode 100644 index 0000000..dd2f296 --- /dev/null +++ b/html/posts/2020-11-10-HTML-cheat-sheet.html @@ -0,0 +1,70 @@ + + + + Blog Post + + + + + + +
+ +
+

H1 is a Large Heading for Post Titles!

+ +

H2 is a Medium Heading

+ +

H3 is a Small Heading

+ +

The <p> tag is for paragraphs. Paragraphs just like this one! This is an example paragraph.

+ +

Here's how you use BOLD text.

+ +

And here's how you use italic text.

+ + The <a> tag is for links! + +
    +
  1. You can make an <ol> like this!
  2. +
  3. <ol> stands for "Ordered List"
  4. +
  5. That means that the list is numbered!
  6. +
+ + + + Concise description of lake photo for screen readers or if image fails to load. +

This is an image caption! Huh? It's just a <p> tag! Ah, but we have added the class "caption"! "Classes" allow us to set special styles for certain elements.

+ +

Ahhh, back to a regular paragraph. All of that italicized text was making me a bit hoarse.

+ + Alt text + +

Wow, that image is smaller and aligned to the right. This text is flowing around it!

+

Oh, I see... we added two classes to it... small and right! Marina must have set special styles in the CSS file for images with the small and right classes. Goodness gracious, what will she think of next?

+

You might be confused if you're viewing this on a phone. When the screen gets really small, then the small class images just revert to taking up the whole width (responsive design). Otherwise they'd just be too ridiculously small! But I bet if you rotate your phone to wide view, you'll be able to see the effects of the small and right classes on images...

+ + Alt text +

Hmmm... there's something strange about this image...

+

Yikes! It's a link!! I guess you can put an <img> tag inside an <a> tag to create an image link!

+

If you've been following along inside the HTML editor, you might be wondering, what are all those weird codes with stuff in-between & and ;? Those are called escape characters. < means "less than" symbol and > means "greater than" symbol. Those symbols are used in HTML tags. But if I try to write actual HTML tags to talk to you about them, then the computer will get confused. So somtimes we need to speak, quite literally, in code, to get around this. Maybe you are like... a math blogger so I thought I'd just let you know ahead of time. If you get unexpected results, check back over your writing. You might have typed something that to a human is normal but to a computer is confusing!

+ + + + + + + +

Well, that's all for now. Keep this file around and use it for reference if you'd like. Happy blogging!

+

~Marina

+
+ +
+ + + + diff --git a/html/posts/2020-11-10-Post-Template.html b/html/posts/2020-11-10-Post-Template.html new file mode 100644 index 0000000..61444e2 --- /dev/null +++ b/html/posts/2020-11-10-Post-Template.html @@ -0,0 +1,27 @@ + + + + Blog Post + + + + + + +
+ +
+

+

+ +

Ready to write? Replace this text with your first paragraph!

+ + +
+
+ +
+ + + + diff --git a/html/readme.txt b/html/readme.txt new file mode 100644 index 0000000..1d28c2c --- /dev/null +++ b/html/readme.txt @@ -0,0 +1,12 @@ +Zonelet Starter +For more information visit https://zonelets.net/ + +Released under MIT License + +Copyright 2020 Marina Kittaka + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/html/script.js b/html/script.js new file mode 100644 index 0000000..f13bcec --- /dev/null +++ b/html/script.js @@ -0,0 +1,229 @@ +/*Welcome to the script file! Your 1st time here, you should update + the BASIC INFO section to include your name and website/social + media link (if desired). Most of the time, you will just come + here to update the POSTS ARRAY. However, you can also edit or + add your own scripts to do whatever you like!*/ + +//TABLE OF CONTENTS + // 1. Basic Info + // 2. Posts Array + // 3. Creating HTML Sections to Be Inserted (Header, Footer, etc) + // 4. Inserting the Sections Into our Actual HTML Pages + +//----------------------------- + +//==[ 1. BASIC INFO ]== + +let blogName = "My Blog Name"; +let authorName = "My Name Here"; +let authorLink = ""; // Enter your website, social media, etc. Some way for people to tell you they like your blog! (Leaving it empty is okay too) + +//----------------------------- + +//==[ 2. POSTS ARRAY ]== + +/*Each time you make a new post, add the filepath here at the top of postsArray. + This will cause all the right links to appear and work. + NOTE: It's important to follow this exact naming convention, because the scripts + below are expecting it ( 'posts/YYYY-MM-DD-Title-of-Your-Post.html', ). You can + alter the scripts if you want to use a different naming convention*/ +/*UPDATE: as of version 1.3, you may omit the date if you would like. But if you + use a date it must still follow that format.*/ + +let postsArray = [ +//[ "posts/2020-11-10-Special-Characters-Example.html", encodeURI( 'Spéci@l "Character\'s" Examp|e' ) ], +//[ "posts/2020-11-10-My-Third-Post-Example.html" ], +//[ "posts/2020-11-10-My-Second-Post-Example.html" ], +[ "posts/2020-11-10-Post-Template.html" ] ]; + +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +/*CAUTION!! BEGINNING OF MORE ADVANCED SECTION! + For default functionality, you DO NOT have to touch anything beyond this point. + Things get more complicated here, so if you are unfamiliar with Javascript, + your site may break. That's okay though, you can always paste back in the code + from the Zonelets starter files :) */ + +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +//==[ 3. GENERATING THE HTML SECTIONS TO BE INSERTED ]== + +let url = window.location.pathname; + +//The date format to look for is 4 digits, hyphen, 2 digits, hyphen, 2 digits, hyphen. +const postDateFormat = /\d{4}\-\d{2}\-\d{2}\-/; + +//Check if you are in posts (if so, the links will have to go up a directory) +let relativePath = "."; +if ( url.includes("posts/") ) { + relativePath = ".."; +} + +//Generate the Header HTML, a series of list items containing links. +let headerHTML = ''; + +//Generate the Footer HTML, which uses the variables defined in the BASIC INFO section above to list info about the site. +//Note: feel free to remove the references to Zonelets and Neocities! Just be careful not to delete any necessary HTML closing tags or other syntax. +let footerHTML = "

" + blogName + " is written by " + authorName + ", built with Zonelets, and hosted by Neocities!

"; + +//To do the following stuff, we want to know where we are in the posts array (if we're currently on a post page). +let currentIndex = -1; +let currentFilename = url.substring(url.lastIndexOf('posts/')); +//Depending on the web server settings (Or something?), the browser url may or may not have ".html" at the end. If not, we must add it back in to match the posts array. (12-19-2022 fix) +if ( ! currentFilename.endsWith(".html") ) { + currentFilename += ".html"; +} +let i; +for (i = 0; i < postsArray.length; i++) { + if ( postsArray[i][0] === currentFilename ) { + currentIndex = i; + } +} + +//Convert the post url to readable post name. E.g. changes "2020-10-10-My-First-Post.html" to "My First Post" +//Or pass along the "special characters" version of the title if one exists +function formatPostTitle(i) { + // Check if there is an alternate post title + if ( postsArray[i].length > 1 ) { + //Remember how we had to use encodeURI for special characters up above? Now we use decodeURI to get them back. + return decodeURI(postsArray[i][1]); + } else { + //If there is no alternate post title, check if the post uses the date format or not, and return the proper title + if ( postDateFormat.test ( postsArray[i][0].slice( 6,17 ) ) ) { + return postsArray[i][0].slice(17,-5).replace(/-/g," "); + } else { + return postsArray[i][0].slice(6,-5).replace(/-/g," "); + } + } +} + +//Get the current post title and date (if we are on a post page) +let currentPostTitle = ""; +let niceDate = ""; +if ( currentIndex > -1 ) { + currentPostTitle = formatPostTitle( currentIndex ); + //Generate the "nice to read" version of date + if ( postDateFormat.test ( postsArray[currentIndex][0].slice( 6,17 ) ) ) { + let monthSlice = postsArray[currentIndex][0].slice( 11,13 ); + let month = ""; + if ( monthSlice === "01") { month = "Jan";} + else if ( monthSlice === "02") { month = "Feb";} + else if ( monthSlice === "03") { month = "Mar";} + else if ( monthSlice === "04") { month = "Apr";} + else if ( monthSlice === "05") { month = "May";} + else if ( monthSlice === "06") { month = "Jun";} + else if ( monthSlice === "07") { month = "Jul";} + else if ( monthSlice === "08") { month = "Aug";} + else if ( monthSlice === "09") { month = "Sep";} + else if ( monthSlice === "10") { month = "Oct";} + else if ( monthSlice === "11") { month = "Nov";} + else if ( monthSlice === "12") { month = "Dec";} + niceDate = postsArray[currentIndex][0].slice( 14,16 ) + " " + month + ", " + postsArray[currentIndex][0].slice( 6,10 ); + } +} + +//Generate the Post List HTML, which will be shown on the "Archive" page. + +function formatPostLink(i) { + let postTitle_i = ""; + if ( postsArray[i].length > 1 ) { + postTitle_i = decodeURI(postsArray[i][1]); + } else { + if ( postDateFormat.test ( postsArray[i][0].slice( 6,17 ) ) ) { + postTitle_i = postsArray[i][0].slice(17,-5).replace(/-/g," "); + } else { + postTitle_i = postsArray[i][0].slice(6,-5).replace(/-/g," "); + } + } + if ( postDateFormat.test ( postsArray[i][0].slice( 6,17 ) ) ) { + return '
  • ' + postsArray[i][0].slice(6,16) + " \u00BB " + postTitle_i + '
  • '; + } else { + return '
  • ' + postTitle_i + '
  • '; + } +} + +let postListHTML = ""; + +//Generate the Recent Post List HTML, which can be shown on the home page (or wherever you want!) +let recentPostsCutoff = 3; //Hey YOU! Change this number to set how many recent posts to show before cutting it off with a "more posts" link. +let recentPostListHTML = "

    Recent Posts:

    '; +} else { + recentPostListHTML += ""; +} + +//Generate the Next and Previous Post Links HTML +let nextprevHTML = ""; +let nextlink = ""; +let prevlink = ""; + +/*If you're on the newest blog post, there's no point to + a "Next Post" link, right? And vice versa with the oldest + post! That's what the following code handles.*/ +if ( postsArray.length < 2 ) { + nextprevHTML = 'Home'; +} else if ( currentIndex === 0 ) { + prevlink = postsArray[currentIndex + 1][0]; + nextprevHTML = 'Home | Previous Post \u00BB'; +} else if ( currentIndex === postsArray.length - 1 ) { + nextlink = postsArray[currentIndex - 1][0]; + nextprevHTML = '\u00AB Next Post | Home'; +} else if ( 0 < currentIndex && currentIndex < postsArray.length - 1 ) { + nextlink = postsArray[currentIndex - 1][0]; + prevlink = postsArray[currentIndex + 1][0]; + nextprevHTML = '\u00AB Next Post | Home | Previous Post \u00BB'; +} + +//----------------------------- + +//==[ 4. INSERTING THE SECTIONS INTO OUR ACTUAL HTML PAGES ]== + +/*Here we check if each relevant div exists. If so, we inject the correct HTML! + NOTE: All of these sections are optional to use on any given page. For example, if there's + one particular blog post where we don't want the footer to appear, + we simply don't put a