ixartz / Eleventy-Starter-Boilerplate

🚀 Eleventy Starter is production-ready with SEO-friendly for quickly starting a blog. ⚡ Built with Eleventy, ESLint, Prettier, Webpack 5, PostCSS, Tailwind CSS 2 and Netlify CMS (optional).
https://creativedesignsguru.com
MIT License
264 stars 56 forks source link

How to change homepage? #6

Closed ahillio closed 3 years ago

ahillio commented 3 years ago

I found this template via the Netlify and would be sooooooo excited about it except that it's making me feel like an idiot. I've worked mostly with PHP/Drupal the last ten years and am new to 11ty and ejs etc.

I want to make the current "home" page accessible via /blog url and create a custom page for home.

But all I can do is break it.

I keep getting Cannot GET / (even on localhost:8080) and can't figure out what causes it. It seems totally random.

I'm able to add a /contact page and can add it to the menu. But can't do that for /blog. Nor can I figure out how to replace the homepage with a custom page via an index.md file.

Any chance you could help me here?

ahillio commented 3 years ago

This is all I've changed since the <4c3dc41> 2021-05-26 commit, and restarting the npm run dev script doesn't solve it, I keep getting Cannot GET /

diff --git a/src/_data/site.json b/src/_data/site.json
index 14825ed..47c66c6 100644
--- a/src/_data/site.json
+++ b/src/_data/site.json
@@ -1,8 +1,8 @@
 {
-  "site_name": "Starter",
-  "title": "Eleventy Starter Boilerplate",
-  "description": "Starter code for your 11ty blog Boilerplate",
-  "url": "https://example.com",
+  "site_name": "Ahelio Digitalis",
+  "title": "Ahelio Digitalis",
+  "description": "Technology solutions and education",
+  "url": "https://www.aheliodigitalis.com",
   "locale": "en",
   "author": "Anonymous"
 }
diff --git a/src/_includes/layouts/base.ejs b/src/_includes/layouts/base.ejs
index c6b1182..f58f8fc 100644
--- a/src/_includes/layouts/base.ejs
+++ b/src/_includes/layouts/base.ejs
@@ -79,9 +79,9 @@
             <li class="mr-6">
               <a
                 class="text-gray-700 border-none hover:no-underline hover:text-gray-800"
-                href="https://github.com/ixartz/Eleventy-Starter-Boilerplate"
+                href="contact"
               >
-                GitHub
+                Contact
               </a>
             </li>
           </ul>

It was just working a moment ago, but now I don't know how to un-break it :(

ahillio commented 3 years ago

dear god, i'll probably get this eventually... so far I can:

to get a /blog.html page.... but how to get just "/blog" without the html?

ahillio commented 3 years ago

Running npm run serve gave error output that was more helpful than npm run dev helping me to understand the global Cannot GET / errors I was getting.

ixartz commented 3 years ago

Awesome! You found a solution for your use cases.

You don't need to worry about .html, most modern hosting services (like Netlify) display pages even without .html

ahillio commented 3 years ago

oh yes, as you said, Netlify makes a "/blog.html" page available via "/blog" (without the .html) was well.

ahillio commented 3 years ago

The new homepage was created simply with an index.md file, after I had renamed the index.ejs to blog.ejs (and did the search/replace inside blog.ejs). I have no idea how many wrong things I tried before getting this obvious/plain/simple solution to work.

ixartz commented 3 years ago

No worries, it's totally normal when you start learning a new tool.