# How to get Obsidian to recognize publish.js file for upload?

**URL:** <https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438>\
**Category:** Help\
**Created:** [March 28, 2021, 12:55pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438 "2021-03-28T12:55:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jujodi](https://forum.obsidian.md/user_avatar/forum.obsidian.md/jujodi/32/12309_2.png) [@jujodi](https://forum.obsidian.md/u/jujodi)\
**Post date:** [March 28, 2021, 12:55pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438/1 "2021-03-28T12:55:06Z")

</div>

I’m running insider build v0.11.10 the release notes say

> Option to run JavaScript on your site, by uploading a file named publish.js in the root of your vault. Note that this is only available for sites under a custom domain.

My site is set up on a custom domain ([https://longpressed.com](https://longpressed.com)) and is also redirected from [https://publish.obsidian.md/patterns](https://publish.obsidian.md/patterns). I was able to set up the GA ID and get that working.

I’m trying to get custom JavaScript to run on my site now.

### Things I have tried

I have a JavaScript file called `publish.js` in the root of my Vault, similar to obsidian.css. It has a few lines of JavaScript in it. When I click publish, I see the obsidian.css file but not the publish.js file. I originally created the file in Obsidian which called it `publish.js.md` but I renamed it and edited it in WebStorm instead.

I’ve searched the Help vault that comes with the insider build as well as the forum. I’ve even tried renaming it to obsidian.js in case that was a typo. I’ve restarted Obsidian and I’ve looked under both unchanged and new menus. I’ve also checked to see if something needed to be enabled in my vault settings and in my site options.

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [March 28, 2021, 1:55pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438/2 "2021-03-28T13:55:42Z")

</div>

you have to wait until 0.11.11 because we made a mistake with the upload procedure of publish.js.  
Sorry!

---

<div class="post-metadata">

**Author:** ![VesterDe](https://forum.obsidian.md/user_avatar/forum.obsidian.md/vesterde/32/32414_2.png) [@VesterDe](https://forum.obsidian.md/u/VesterDe)\
**Post date:** [July 21, 2022, 1:23pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438/3 "2022-07-21T13:23:50Z")

</div>

This is happening to me right now.

Here is a test site: [Obsidian Publish](https://publish.obsidian.md/test)

I published a css and a js file. The css file works, and is changing the title to red, but the js is not being run. I don’t know what to do?

I can also see the file does exist in a route identical to the publish.css file:  
[https://publish-01.obsidian.md/access/22f078957f9fe2938b4615a983ef8170/publish.js](https://publish-01.obsidian.md/access/22f078957f9fe2938b4615a983ef8170/publish.js)

It just isn’t being loaded.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![ven\_electric](https://forum.obsidian.md/user_avatar/forum.obsidian.md/ven_electric/32/34517_2.png) [@ven\_electric](https://forum.obsidian.md/u/ven_electric)\
**Post date:** [September 13, 2022, 8:25pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438/4 "2022-09-13T20:25:21Z")

</div>

Wanted to bump this because I’m running into a similar issue I think.

publish.js doesn’t seem to do anything. Even if I simply use a console.log(“test”), nothing is logged in the console when I visit my site.

Using Obsidian v0.15.9

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [October 16, 2022, 6:29pm UTC](https://forum.obsidian.md/t/how-to-get-obsidian-to-recognize-publish-js-file-for-upload/15438/5 "2022-10-16T18:29:00Z")

</div>

Closed on October 16, 2022, 6:29pm UTC


