Open luckypoem opened 8 years ago
Hi @luckypoem
Could you show me what's inside your posts
folder? And what is the content of each files in it?
A post should has the minimum format of:
# title
and the content
hi.
root@AR:/usr/local/azeroth-js-site# node generator.js /usr/local/azeroth-js-site/generator.js:29 if (lines[lines.length - 6].indexOf('<meta') == 0) { ^
TypeError: Cannot read property 'indexOf' of undefined at /usr/local/azeroth-js-site/generator.js:29:35 at FSReqWrap.readFileAfterClose as oncomplete root@AR:/usr/local/azeroth-js-site# cd posts root@AR:/usr/local/azeroth-js-site/posts# ls home.html home.md lorem-ipsum.html lorem-ipsum.md test-1.md root@AR:/usr/local/azeroth-js-site/posts# cat test-1.md
this is test1. root@AR:/usr/local/azeroth-js-site/posts#
is the format of test-1.md not correct?
or my nodejs version is not ok?
root@AR:/usr/local/azeroth-js-site/posts# node -v v5.3.0 root@AR:/usr/local/azeroth-js-site/posts#
No 😄 your nodejs is ok.
The issue is what it say:
Cannot read property 'indexOf' of undefined
In this code:
if (lines[lines.length - 6].indexOf('<meta') == 0) {
Your file is just two lines, less than 6 lines, so the statement lines[lines.length - 6]
should be lines[-4]
, and of course it's doesn't exist :D
We should have a null check for this one.
And the solution for you at this time is your post should be longer than 6 lines 😅
hi. it's ok now. and pagination is feasible?
We have to add the posts to home page manually at this time (by editting home.md
). It's possible to generate the home page dynamically but I need to find sometime do do it :D
Hi, I'm willing to help, what do you actually wanna do?
Hi @juancuiule, thanks for interesting on this.
I think what need to be done here is:
.md
file has less than 6 linesindex.html
with the posts we want to publish, because right now we have to add the link manually to home.md
file, and the generator.js
will read this file and convert it to index.js
This can be submitted as 2 separated Pull Request.
P/S: And if you gonna submit it before Monday, don't forget to put the hacktoberfest
label to the pull request, heheh
Working on the second one
Partially done in PR #9
hi.
root@AR:/usr/local/azeroth-js-site# node generator.js /usr/local/azeroth-js-site/generator.js:29 if (lines[lines.length - 6].indexOf('<meta') == 0) { ^
TypeError: Cannot read property 'indexOf' of undefined at /usr/local/azeroth-js-site/generator.js:29:35 at FSReqWrap.readFileAfterClose as oncomplete root@AR:/usr/local/azeroth-js-site#
thanks