Added auto page script#44
Conversation
👷 Deploy request for codestitch-intermediate pending review.Visit the deploys page to approve it
|
|
The core idea is solid and genuinely useful. Thanks for the contribution @CalgaryWebStudios ! Apart from the bug fixes and small tweaks I've highlighted above, there are consistencies I'd like to maintain in the way code is written and formatted, and I think there should also be a new section in the readme to explain how to use the script. I'm going to prepare some changes on my branch. In the meantime, feel free to chime in on my code review comments. Thanks again and looking forward to hearing from you. |
|
Thanks for taking a look @BuckyBuck135! I looked in the files changed and could not find any comments that were left, perhaps I am missing something? Looking forward to seeing the changes on your branch! |
| description: "Meta description for the page" | ||
| image: "OPTIONAL - If an image path is specified here, it will be used for that page's OG image. Useful for blog posts (implemented as standard with this kit)" | ||
| eleventyComputed: | ||
| title: "{{ page.fileSlug | titleCase }} | {{ client.name }} | {{ client.address.city }}, {{ client.address.state }}" |
There was a problem hiding this comment.
I think I'd rather NOT have an opinionated, computed value for the title to keep it simple for the developer. Current pages use a simple string value for the title, and the computed version requires some level of understanding of the Eleventy cascade and project.
Thoughts?
There was a problem hiding this comment.
Yeah I fully understand where your coming from, the way that I see it is that most people would follow the original title structure in the kit which is "About Us | Johns Plumbing", and instead of manually typing it as a string, it could be automated, with the addition of "City, State" so "About Us | Johns Plumbing | Calgary, AB".
Yes you are correct that it requires some level of understanding, but so does the rest of the kit, in my opinion.
Sorry, I forgot to submit the review lol |
…itleCase filter, optional CTA in _template.txt
…itleCase filter, optional CTA in _template.txt
|
Fixed naming inconsistensies, cleaned up extra code, refactored the titleCase filter, optional CTA in _template.txt. Let me know what you think. |
I added a new file called "create-page.js" in the scripts folder, what it does is it auto generates 1 or multiple pages for the user, and it automatically creates its corresponding .LESS file as well, it places everything in the correct directories and it auto pastes the _template.txt.
I updated _template.txt so now it will automatically populate the permalink section with the HTML file slug, and the page title will automatically be set to "Page Name | Client | City, State". Another change I made was to auto-link the new generated CSS file in the head. Another repetitive task fully automated.
To allow for these changes, I added a new custom filter in ".eleventy.js" on line 87.
I also updated the package.json with the command name, I used "new-page"
USAGE:
I hope you find this useful for the Code Stitch community! If not, no worries, but for me personally, it saves a ton of time!