Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Resources.ByType "video" return empty result #8052

Closed
wangchucheng opened this issue Dec 15, 2020 · 8 comments · Fixed by #8065
Closed

.Resources.ByType "video" return empty result #8052

wangchucheng opened this issue Dec 15, 2020 · 8 comments · Fixed by #8065
Assignees
Milestone

Comments

@wangchucheng
Copy link

What version of Hugo are you using (hugo version)?

$ hugo version 0.78.2

Does this issue reproduce with the latest release?

Yes

Description

I want to access video files by .Resources.ByType "video", but the result is empty. I also look at mediaType.go, which shows that .mp4 and .webm is supported.

After more tests, I found that video can be accessed by using its suffix. For example, I can access 1.mp4 by .Resources.ByType "mp4", and access 1.webm by .Resources.ByType "webm". But none of these can be accessed by .Resources.ByType "video".

But for images, I can use .Resources.ByType "image" to access it instead of .Resources.ByType "png", which is totally contradictory to videos.

I was suggested to open an issue for this in hugo community.

See also https://discourse.gohugo.io/t/resources-bytype-video-return-empty/29975

@onedrawingperday
Copy link
Contributor

This is a request for a new method i.e. .Resources.ByType "video"

@wangchucheng
Copy link
Author

This is a request for a new method i.e. .Resources.ByType "video"

Thanks for your supplement, I thought it was a bug before😝

@cmahnke
Copy link

cmahnke commented Dec 16, 2020

See also #7671.
This would also be a great opportunity to provide a video shortcode, similar to figure to make video content a first-class citizen in the Hugo ecosystem, without relying on external services like Youtube and Vimeo.

This would also be desirable when taking #7893 into account: Before removing third party services Hugo should provide some sort of feature symmetry, that means providing some basic functionality to replace external services, this would also require a HTML / IFrame shortcode.

This would also make a nice Christmas present: Hugo 0.80 "Video Edition" ;)

@martignoni
Copy link
Contributor

@cmahnke Meanwhile, you can use this: https://github.com/martignoni/hugo-video. Not so nice Christmas present, but still :-)

@bep bep self-assigned this Dec 16, 2020
@bep bep added the Bug label Dec 16, 2020
@bep bep added this to the v0.80 milestone Dec 16, 2020
@bep
Copy link
Member

bep commented Dec 16, 2020

There is a special case in there for images ... not sure why I put that in there, I must have thought about the generic application/text types not being very useful. But the documentation is clear, so we need to fix this.

@wangchucheng
Copy link
Author

wangchucheng commented Dec 17, 2020

There is a special case in there for images ... not sure why I put that in there, I must have thought about the generic application/text types not being very useful. But the documentation is clear, so we need to fix this.

Thanks for the incoming fix! And another strange bug (I think) is videos can be accessed by methods like .Resources.ByType "webm", but they will not be included in production files (public folder). So the link will renturn a 404 error.

Btw, only assets folder. Videos in static can be included in production files.

@bep
Copy link
Member

bep commented Dec 17, 2020

videos can be accessed by methods like .Resources.ByType "webm", but they will not be included in production files (public folder). So the link will renturn a 404 error.

The above is certainly not related to this particular issue.

bep added a commit to bep/hugo that referenced this issue Dec 17, 2020
The one exception being for the Page, which does not have a MIME type, in which you will get the value `page`.

Fixes gohugoio#8052
bep added a commit to bep/hugo that referenced this issue Dec 17, 2020
The one exception being for the Page, which does not have a MIME type, in which you will get the value `page`.

Fixes gohugoio#8052
@bep bep closed this as completed in #8065 Dec 17, 2020
bep added a commit that referenced this issue Dec 17, 2020
The one exception being for the Page, which does not have a MIME type, in which you will get the value `page`.

Fixes #8052
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants