# Broken links in components

**URL:** <https://forum.pinegrow.com/t/broken-links-in-components/726>\
**Category:** Components\
**Created:** [February 23, 2017, 11:17pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726 "2017-02-23T23:17:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![msavard](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@msavard](https://forum.pinegrow.com/u/msavard)\
**Post date:** [February 23, 2017, 11:17pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/1 "2017-02-23T23:17:44Z")

</div>

When using components I am getting broken links all over the place.

My component is a main menu. It is defined in a masterpage at the root level. If I link to a page in another directory, it uses the relative URL **from the masterpage**. This works fine as long as all the pages it is used on are also at root level.

But when I put this on a page that is **not** in the root level (in a folder) the links are all messed up. Each link in the component is treated as if the page the component is on is in the root level.

I can fix this be going to each page and clicking on ‘Fix Links’ but this is hardly a solution as the next time I update that component I will have to click ‘Fix Links’ on each page in my site.

Is this a known bug or am I doing something wrong?

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![Farscaper](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/farscaper/32/385_2.png) [@Farscaper](https://forum.pinegrow.com/u/Farscaper)\
**Post date:** [February 24, 2017, 11:20pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/2 "2017-02-24T23:20:35Z")

</div>

I’ve encountered the same thing but figured I just didn’t know enough yet. I have hundreds of pages and folder levels that go up to five levels deep.

Now I’m afraid to update components for fear they will revert to a broken status.

I’ve even resorted to using full urls rather than internal links.

Hopefully someone will shine some light on our darkest fears or lack of knowledge.

---

<div class="post-metadata">

**Author:** ![Rob](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/rob/32/9_2.png) [@Rob](https://forum.pinegrow.com/u/Rob)\
**Post date:** [February 27, 2017, 10:32am UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/3 "2017-02-27T10:32:48Z")

</div>

@msavard @Farscaper this is from the documentation “[How to reuse the same menu component on multiple pages](http://docs.pinegrow.com/pinegrow-pro/components/reuse-menu-component-multiple-pages)” and it might be helpful.

" **Updating the menu**

Now, whenever we need to change the menu we just do the change on the main page where the component is defined and use Component -\> Update to apply the change to all component instances.

Quick update will update all open pages. Update whole project will update all pages in the project. Remember, that in both cases you need to manually save changed files."

If this works could you post back here just in case others hit the same difficulty… also let us know if it doesn’t work 🙂

---

<div class="post-metadata">

**Author:** ![Farscaper](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/farscaper/32/385_2.png) [@Farscaper](https://forum.pinegrow.com/u/Farscaper)\
**Post date:** [February 27, 2017, 3:07pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/4 "2017-02-27T15:07:20Z")

</div>

Yes, I did follow that tutorial. One thing that detracts from the usefulness of components is the need to save each page afterwards when you have a very large site. Even with ten pages you have to open them all just to save them.

Imagine when I have hundreds and they are hidden in sub-folders.

---

<div class="post-metadata">

**Author:** ![rolandk](https://avatars.discourse-cdn.com/v4/letter/r/6de8d8/32.png) [@rolandk](https://forum.pinegrow.com/u/rolandk)\
**Post date:** [February 28, 2017, 4:54pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/5 "2017-02-28T16:54:55Z")

</div>

I am now using partial “includes” for the menus and headers via a javascript. This makes it a little less of a hassle to update docs. However, I’m still experiencing link issues when using MAMP, which seems to interact with PG like an external editor by changing my “/” relative links to “localhost:…” etc.

P.S. I use MAMP to render my JS included pages…because PG doesn’t seem to do this, yet.

---

<div class="post-metadata">

**Author:** ![schpengle](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/schpengle/32/238_2.png) [@schpengle](https://forum.pinegrow.com/u/schpengle)\
**Post date:** [March 30, 2017, 10:56am UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/6 "2017-03-30T10:56:58Z")

</div>

HI All  
now, A bug report. Well, two.

Bug 1.

I, like Simmo have followed through the Blocks/components usage instructions and have never got them quite right. so here goes.

1. Attempting to use BenHanna’s blocks as a library.  
He has two Blocks kits on offer, _Cards_ and his _Preview_ selection.

this is clever and allows for scalability however it doesn’t seem to work correctly.

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/1X/c6841d5f65a91434b4f2d4f8692001ffa248ec55.jpg)

in the above diagram I have already manually corrected the first two image paths as they too, didn’t show up.

As you can see, PG uses this whole _Add resources to Library_ thing from Project A, for the component library-but then DOESNT actually seem to add this actual resource link to the New, Project B! - it doesnt add the correct path.

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/1X/97a0ff60b689b0cdfc8489af8ca11442cda67145.jpg)

So I think the solution is for the PATH to include the Library Assets of Project B in project A as, currently, it doesnt.  
that is /components/whateverproject/css, and the same for images, js, whatever.

I get the idea of adding the project A library in a separate component directory in B to prevent conflicts! this is CLEVER 🙂  
however, you still have to MANUALLY prepend /components/cards/ to each resource directory you use from Project A into Project B.

The current fudge solution is to not amend the path as above, but rather to copy all relevent Project A css files to css folder, js to js folder etc etc. However, that means, if your using PROJECT A as a library in 10 projects… every time you change a component in A, you have REMEMBER which projects used A as a library and go and manually copy the files again! EEK! not scalable.

now, am I doing this correctly or is this a bug?

so if you add projects as a library and then every thing goes KaBoOoOM!  
check this out and see if it helps until this bug is addressed

And here is the correct path for the cards block kit, if added via _Use Project as a Library_

.

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/1X/e868b436f4189c2e64bff72a33da47020cff54c5.jpg)

Bug 2.

Also, when adding these resources to the _Project A_ in your instructions on

[http://docs.pinegrow.com/pinegrow-pro/components/libraries](http://docs.pinegrow.com/pinegrow-pro/components/libraries)

I then drag and drop them into the same order as the original project, but, that doesnt seem to stick! they re order themeselves in Project B,

 ![](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/1X/234a789dbd1195f4e90f379b9f0b74ea5a7d6a4c.jpg)

to alphabetical order I think, and so you loose the CSS cascade and so again, manually have to go back and look at and compare project A order, then reorder them in _Project B_ to be the same. - thats after you have had to manually edit the /component/ css library path if it doesnt seem to map.

Here is a link to what I just posted with regards this in on our forum

> [@130 Blocks for Pinegrow - Loads like Bootstrap Blocks for Pinegrow](http://forum.pinegrow.com/t/130-blocks-for-pinegrow/801/16):
>
> Cheers @benhanna, I think there is a bug in PG with regards Using Projects as a library and adding/ resources to the library. Ive followed the docs here [http://docs.pinegrow.com/pinegrow-pro/components/libraries](http://docs.pinegrow.com/pinegrow-pro/components/libraries) and in the second part, where it explains how to add the assets to Project A so you can use in Project B well, it doenst seem to work as It maps all the assets to the /css /images /js directories, NOT to /components/cards/css /components/cards/images /components/cards/js di…

there you go.

if Im doing it wrong, please correct me 🙂

But I dont seem to be alone. So, thanks @Simmo, as if you hadnt said that you too, were finding it impossible and too much like hard work to get them to work, as well, then I wouldnt have burrowed to the bottom of this!

As I too, gave up… and just hoped V3.0 would make it easier! 😃 not realising it might be bust!  
But, how come, NO ONE ELSE, worked this out? or were more vocal.  
I think we need a BUG topic on our forum too. … as I can no longer post on Slack (unless we get irc gateway added) and, after all, I WAS the Champion Bug buster for a while… pretty sure I lost that title a few times over now though 🙂

This is why I never used components or libraries, as I thought I was confused and couldn’t get them to work.  
Maybe it was my tool of choice that failed me though! 😃

I will try again in a bit, as I have a show this weekend ! 🙂  
For [http://wellbingessences.com](http://wellbingessences.com)  
In Swansea Leisure Centre, South Wales. if you’re about, pop in 🙂

---

<div class="post-metadata">

**Author:** ![schpengle](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/schpengle/32/238_2.png) [@schpengle](https://forum.pinegrow.com/u/schpengle)\
**Post date:** [March 31, 2017, 10:24am UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/7 "2017-03-31T10:24:02Z")

</div>

Well, I just edited the above as it seemed to have exploded and put all the images in the wrong order. Makes more sense now.

---

<div class="post-metadata">

**Author:** ![bhsiao](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@bhsiao](https://forum.pinegrow.com/u/bhsiao)\
**Post date:** [October 7, 2019, 6:03pm UTC](https://forum.pinegrow.com/t/broken-links-in-components/726/8 "2019-10-07T18:03:20Z")

</div>

Exactly. I wish there was an easier way to update and save.
