Static asset (mp4) moved in the wrong folder building website. can someone help me?

Hi.
i’m creating a web tv generator. i’m using the standard tinyce-hugo-theme-master theme with a custom tag added in the single.html

i put videos in

/content/folder1
/content/folder2
/content/folderN

and so on.

using a python script,

i generate a .md file for every videos with two custom keyword (videosrc and videoposter) and i bind those custom keyword on the template assuming relative path starting from the same folder so, for example ,

this is the tree of my /content


├───Cetto Laqualunque
├───Ingegner Cane
├───Sensualita A Corte
└───Tassista di notte
Tassista.m4v
Tassista.md

and the template has this video tag

As i said, the script search for every video file and create the relative .md content so for example for Tassista.m4v i obtain

+++
Description = "Tassista"
Title = "Tassista"
videoposter = "Tassista.jpg"
videosrc = “Tassista.m4v”
+++

Now, when i compile the website,

C:\Users\Andrea\Desktop\hugo_0.16_windows-64bit\maidiretv>hugo
Started building site
0 draft content
0 future content
1 pages created
2 non-page files copied
0 paginator pages created
0 tags created
0 categories created
in 109 ms

the video is moved in the wrong folder as you can see opening

http://maidiretv.altervista.org//tassista-di-notte/Tassista/

in fact, this is the “tree” output of the folder

├───Tassista di notte
│ Tassista.m4v

└───tassista-di-notte
│ index.html
│ index.xml

└───Tassista
index.html

so, the questions are,

why the folder “Tassista di notte” is generated? why the file isn’t moved in the right folder, “tassista-di-notte”, where the html file is? Due Hugo move the static asset for me, i think there is something wrong with some script.

thanks a lot.

i also tried to remove empty spaces in my /content folder renaming

“tassista di notte” to “tassista-di-notte”

now hugo move the video in the “list” folder and not in the “page” folder

/content


├───Cetto Laqualunque
├───Ingegner Cane
├───Sensualita A Corte
└───tassista-di-notte
Tassista.m4v
Tassista.md

/public


└───tassista-di-notte
│ index.html
│ index.xml
│ Tassista.m4v

└───Tassista
index.html

Tassista.m4v should to be in Tassista subfolder due index.html of Tassista has this html video tag

A static file, like mp4, is typically placed in the /static/ folder whereas the /content/ folder is for the written content files (like markdown).

See source organisation for an overview.

I don’t understand the second part of this sentence and have a hard time differentiating between those different foreign words since they all seem so similar to me, but for the first part:

to put the m4v file in the /tassista/ subfolder (relative to root) when rendering the website, put it in /static/tassista/ and it will render at www.example.com/tassita/example.m4u.

1 Like

thanks :slightly_smiling:
i read


and

how should i build the relative path to the subfolder? due i put videos on

/static/videos/cats/
/static/videos/dogs/
/static/videos/kids/

i need to point to subfolders based on content path but there is something wrong with something like a url encode of the / character

my template now is

<video style="width:100%" src="{{ .Site.BaseURL }}{{ .File.Dir }}{{ .Params.videosrc }}" poster="{{ .Site.BaseURL }}{{ .File.Dir }}{{ .Params.videoposter}}" controls autoplay></video>

but browser are searching for

http://localhost:1313/cats\cat1.m4v

and not

http://localhost:1313/cats/cat1.m4v

how can i solve this problem?

thanks

i solved using .Section

  <video style="width:100%" src="{{ .Site.BaseURL }}{{.Section}}/{{ .Params.videosrc }}" poster="{{ .Site.BaseURL }}{{.Section}}/{{ .Params.videoposter}}" controls autoplay>