pixelnest / presskit.html

Re-implementation of presskit() as a static site generator
http://pixelnest.io/2017/03/presskit-html/
MIT License
314 stars 53 forks source link

Fix error when not company found #1

Closed Coac closed 7 years ago

Coac commented 7 years ago

Fix following error :

λ presskit ..\product-presskit\
Starting directory: ..\product-presskit\

Finding data…
- product: "My Super Game" ..\product-presskit\data.xml

Generating HTML…
C:\Users\Coac\Documents\Projects\presskit\lib\core\generator.js:119
        company: pages.company.presskit,
                              ^

TypeError: Cannot read property 'presskit' of undefined
    at generateHTML (C:\Users\Coac\Documents\Projects\presskit\lib\core\generator.js:119:31)
    at Object.generate (C:\Users\Coac\Documents\Projects\presskit\lib\core\generator.js:36:3)
    at parseEntryPoint (C:\Users\Coac\Documents\Projects\presskit\lib\index.js:30:15)
    at fs.stat (C:\Users\Coac\Documents\Projects\presskit\lib\index.js:48:7)
    at FSReqWrap.oncomplete (fs.js:153:5)

occured when using presskit ..\product-presskit\ on a folder containing only one product and no company.

solarsailer commented 7 years ago

Hello,

Thanks for your contribution.

However, the problem was more concealed than it appears. This case was already handled, but this condition was too strict and didn't handle trailing slashes. That's why you had this error (the generator should have shown "your top level page is not a page" instead of the error).

A warning though: a presskit should have a company page. The main page is different from the others, and if you use a product as the company, it will have some issues (address, socials, etc.).

You can get the fix in the 0.6.3.

Cheers.