gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.78k stars 7.53k forks source link

Non-MD files in the content directory (like jpg's and png's) end up as html's #147

Closed RubenN closed 9 years ago

RubenN commented 10 years ago

When I put non-md files in the content directory, they should just be copied over (untouched!).

Now they end up as html's

spf13 commented 9 years ago

To everyone. I committed a generic file handler that simply places the files in the same path in the destination directory. This will enable people to place images and other files along side their content. There's still a bit more to do around this, but the fundamental issue / request in these 3 tickets is solved. It does need a bit of testing so I'd love everyone to check out head and play with it.

eduncan911 commented 9 years ago

Awesome Steve!

Will let know in the next few days!

-E On May 20, 2015 7:06 PM, "Steve Francia" notifications@github.com wrote:

To everyone. I committed a generic file handler that simply places the files in the same path in the destination directory. This will enable people to place images and other files along side their content. There's still a bit more to do around this, but the fundamental issue / request in these 3 tickets is solved. It does need a bit of testing so I'd love everyone to check out head and play with it.

— Reply to this email directly or view it on GitHub https://github.com/spf13/hugo/issues/147#issuecomment-104067783.

bep commented 9 years ago

Works for me.

FooSoft commented 9 years ago

Thank you very much for this change.

FooSoft commented 9 years ago

Running into an issue when I have HTML files (specifically reveal.js stuff) along with markdown files:

ERROR: 2015/05/21 Error rendering site: Error(s) rendering pages: template: __research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html:188: function "socketId" not defined
Available templates:
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/examples/embedded-media.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/test-markdown-element-attributes.html
ERROR: 2015/05/21   _internal/shortcodes/test.html
ERROR: 2015/05/21   partials/header.html
ERROR: 2015/05/21   partials/photos.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/examples/barebones.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/plugin/notes/notes.html
ERROR: 2015/05/21   
ERROR: 2015/05/21   _internal/shortcodes/ref.html
ERROR: 2015/05/21   _internal/_default/sitemap.xml
ERROR: 2015/05/21   partials/navbar.html
ERROR: 2015/05/21   _internal/google_news.html
ERROR: 2015/05/21   404.html
ERROR: 2015/05/21   partials/article-contents.html
ERROR: 2015/05/21   partials/github.html
ERROR: 2015/05/21   _internal/shortcodes/highlight.html
ERROR: 2015/05/21   _internal/_default/rss.xml
ERROR: 2015/05/21   _internal/disqus.html
ERROR: 2015/05/21   _internal/twitter_cards.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/plugin/markdown/example.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/examples/slide-backgrounds.html
ERROR: 2015/05/21   _internal/pagination.html
ERROR: 2015/05/21   _default/single.html
ERROR: 2015/05/21   _internal/shortcodes/relref.html
ERROR: 2015/05/21   _internal/shortcodes/figure.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/test-pdf.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/test-markdown-slide-attributes.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/test.html
ERROR: 2015/05/21   __research/search/presentation/index.html
ERROR: 2015/05/21   _internal/schema.html
ERROR: 2015/05/21   partials/article-summary.html
ERROR: 2015/05/21   partials/footer.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/index.html
ERROR: 2015/05/21   _internal/opengraph.html
ERROR: 2015/05/21   _default/list.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/examples/math.html
ERROR: 2015/05/21   __research/search/presentation/bower_components/reveal.js/test/test-markdown.html
CRITICAL: 2015/05/21 Error(s) rendering pages: template: __research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html:188: function "socketId" not defined

It appears that Hugo tries to interpret them as templates.

spf13 commented 9 years ago

Html files are interpreted as content files and will be parsed as such when in the content directory. 

If you would like them to not be parsed then they need to be in the static directory. 

This error seems to indicate that they are not in the content directory but in layouts as that is the only place where templates are looked for. Can you provide more complete paths for these files?

Best, Steve

-- 

Steve Francia steve.francia@gmail.com

Docker Inc http://spf13.com 

     

On May 21, 2015 at 12:56:46 AM, Alex Yatskov (notifications@github.com) wrote:

Running into an issue when I have HTML files (specifically reveal.js stuff) along with markdown files:

ERROR: 2015/05/21 Error rendering site: Error(s) rendering pages: template: research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html:188: function "socketId" not defined Available templates: ERROR: 2015/05/21 __research/search/presentation/bower_components/reveal.js/test/examples/embedded-media.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/test-markdown-element-attributes.html ERROR: 2015/05/21 _internal/shortcodes/test.html ERROR: 2015/05/21 partials/header.html ERROR: 2015/05/21 partials/photos.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/examples/barebones.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/plugin/notes/notes.html ERROR: 2015/05/21
ERROR: 2015/05/21 _internal/shortcodes/ref.html ERROR: 2015/05/21 _internal/_default/sitemap.xml ERROR: 2015/05/21 partials/navbar.html ERROR: 2015/05/21 _internal/google_news.html ERROR: 2015/05/21 404.html ERROR: 2015/05/21 partials/article-contents.html ERROR: 2015/05/21 partials/github.html ERROR: 2015/05/21 _internal/shortcodes/highlight.html ERROR: 2015/05/21 _internal/_default/rss.xml ERROR: 2015/05/21 _internal/disqus.html ERROR: 2015/05/21 _internal/twitter_cards.html ERROR: 2015/05/21
research/search/presentation/bower_components/reveal.js/plugin/markdown/example.html ERROR: 2015/05/21
research/search/presentation/bower_components/reveal.js/test/examples/slide-backgrounds.html ERROR: 2015/05/21 _internal/pagination.html ERROR: 2015/05/21 _default/single.html ERROR: 2015/05/21 _internal/shortcodes/relref.html ERROR: 2015/05/21 _internal/shortcodes/figure.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/test-pdf.html ERROR: 2015/05/21 __research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/test-markdown-slide-attributes.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/test.html ERROR: 2015/05/21 __research/search/presentation/index.html ERROR: 2015/05/21 _internal/schema.html ERROR: 2015/05/21 partials/article-summary.html ERROR: 2015/05/21 partials/footer.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/index.html ERROR: 2015/05/21 _internal/opengraph.html ERROR: 2015/05/21 _default/list.html ERROR: 2015/05/21 research/search/presentation/bower_components/reveal.js/test/examples/math.html ERROR: 2015/05/21 __research/search/presentation/bower_components/reveal.js/test/test-markdown.html CRITICAL: 2015/05/21 Error(s) rendering pages: template: research/search/presentation/bower_components/reveal.js/plugin/notes-server/notes.html:188: function "socketId" not defined

It appears that Hugo tries to interpret them as templates.

— Reply to this email directly or view it on GitHub.

FooSoft commented 9 years ago

I ended up moving the stuff out of content into static and it's all groovy now. I was just under the impression that with this new change, when processing the content directory, Hugo would convert markdown files to HTML, and pass everything else through without processing it (I thought that the layout directory is the only place that would be processed for templates). I'll post a repro in a few.

spf13 commented 9 years ago

The intent of /content is things are in there to be processed. This change does permit files to live alongside the content and if a dedicated handler isn't found it will just copy them over. This isn't the safest thing to do as in the future a handler may be defined for the file type and change the behavior. For instance, we could (and probably will) add a handler that does some automatic optimization to images... a generally but not universally desirable feature. If you want the images untouched...

The intent of /static is that things in there are not to be processed and will be copied over exactly as they are.

spf13 commented 9 years ago

It's also the case that hugo supports html, markdown, asciidoc and rst currently as content files.

eduncan911 commented 9 years ago

There's the list... Was searching the docs for what is currently processes.

Maybe someone with a little more time can update the docs and submit a pull request. (FYI, the Hugo docs is in github as well, generated by Hugo itself - by Steve I am guessing). On May 21, 2015 8:30 AM, "Steve Francia" notifications@github.com wrote:

It's also the case that hugo supports html, markdown, asciidoc and rst currently as content files.

— Reply to this email directly or view it on GitHub https://github.com/spf13/hugo/issues/147#issuecomment-104254811.

FooSoft commented 9 years ago

In case there is interest, I put up the website that illustrates the issue I was having here (5mb download):

http://foosoft.net/dl/hugo-repro.tar.gz

zachio commented 9 years ago

Can you make hugo ignore desktop.ini files? Google Drive puts that file in there if youre using Google Drive sync on Windows. So you have to manually delete all the desktop.ini files to get Hugo to work.

bep commented 9 years ago

@zachdyer ini-files should be covered by fc946ded29149443e21587c7f513d4550dc67f39 . Have you tested this with Hugo 0.14?

zachio commented 9 years ago

Actually no but good job dude yes!

On Wed, May 27, 2015 at 3:48 PM, Bjørn Erik Pedersen < notifications@github.com> wrote:

@zachdyer https://github.com/zachdyer ini-files should be covered by fc946de https://github.com/spf13/hugo/commit/fc946ded29149443e21587c7f513d4550dc67f39 . Have you tested this with Hugo 0.14?

— Reply to this email directly or view it on GitHub https://github.com/spf13/hugo/issues/147#issuecomment-106069347.

[image: ZachDyerDesignHeaderGoogle.png] Zach Dyer 1471 W South St. Ozark, MO 65721 417.582.5445 www.zachdyerdesign.com hosting.zachdyerdesign.com

Breach of confidentiality & accidental breach of confidentiality

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

gima commented 9 years ago

Does not work with permalinks.

Files are laid out in a directory path matching the pre-permalink URL, thus effecively ignoring permalinks completely.

Should a new bug report be opened or is this sufficient?

fazalmajid commented 8 years ago

Interesting discussion. I am in the process of converting a WP blog to Hugo, and my last big hurdles are image gallery handling and ATOM support. To be a world-class platform, Hugo needs fully integrated media management.

I am experimenting with a different approach than what was suggested above: treat JPEG files in /content as an external media type (the same way asciidoc, mmark, ReST and HTML are treated), copy the file as-is, but process its metadata (EXIF/IPTC/XMP/ICC) as implied front matter, and provide templates with functions that can perform standard image operations like thumbnail generation, resizing, watermarking, cropping, and so on.

This would allow templates to become full-fledged gallery generators, e.g. automatically generate a photoblog or galleries from photos dropped into /content/photos/ by Lightroom et al. This seems to me like more powerful and extensible, and aligned with the design of Hugo (and the limitations of Go in terms of lacking dynamic linking or similar extensibility mechanisms to implement plugins).

I'll share my work if it turns out to be successful. Happy Thanksgiving!

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.