# Error when clicking on the homepage logo

**URL:** https://meta.discourse.org/t/error-when-clicking-on-the-homepage-logo/306644
**Category:** Development
**Created:** [May 3, 2024, 12:38pm UTC](https://meta.discourse.org/t/error-when-clicking-on-the-homepage-logo/306644 "2024-05-03T12:38:35Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [May 4, 2024, 12:09am UTC](https://meta.discourse.org/t/error-when-clicking-on-the-homepage-logo/306644/11 "2024-05-04T00:09:47Z")

</div>

I would highly recommend you to not going that path. It’s like applying a band-aid to a side effect instead of fixing the root cause of the issue. You will create more problems with it (like your latest [topic](https://meta.discourse.org/t/assigning-a-separate-link-to-the-logo/306688/2) because of the above code)

You can make your JS a little more discourse friendly (_the best way is still using plugin outlet when you can_).  
Here an example. It uses the API on page change, runs code on specific route, and copy the HTML before the link (so you can click on the tag):

> **JS**
>
> ```js
> <script type="text/discourse-plugin" version="0.8">
> const { next } = require("@ember/runloop");
>   
> function moveTags() {
> const mainLinks = document.querySelectorAll(".main-link:not(.tags-moved)");
>     
> mainLinks.forEach((mainLink) => {
> const discourseTags = mainLink.querySelector(".discourse-tags");
> const titleElement = mainLink.querySelector("a[data-topic-id]");
> 
> if (discourseTags && titleElement) {
> titleElement.insertAdjacentHTML("beforebegin", discourseTags.outerHTML);
> mainLink.classList.add('tags-moved');
> }
> });
> }
> 
> api.registerModelTransformer("topic", async (topics) => {
> next(() => {
> moveTags();
> })
> });
> 
> api.onPageChange((url) => {
> if (url.startsWith("/categories")) {
> moveTags();
> }
> });
> </script>
> 
> ```

> **CSS**
>
> ```css
> .top-row, 
> .link-top-line {
> .discourse-tag {
> font-size: var(--font-down-2) !important;
> padding: 2px 8px;
> margin: 2px 5px 2px -6px;
> border-radius: 10px;
> border: 1px solid #444460;
> background-color: #1f1f33;
> }
>     
> .discourse-tag::after {
> content: '' !important;
> margin-left: 0 !important;
> }
> }
> 
> .bottom-row, 
> .link-bottom-line {
> .discourse-tags {
> display: none;
> }
> }
> 
> ```

---

_[View the full topic](https://meta.discourse.org/t/error-when-clicking-on-the-homepage-logo/306644)._
