1

I have created one Static block with added below content in and I need to add social links in PWA.

<a class="footer-facebook" href="https://www.facebook.com/" target="_blank" rel="noopener">Facebook</a>

Above code is not working anyone have idea how to add URL in PWA ?

1 Answer 1

2

Right now there isn't just one way to set up a custom theme in PWA studio, so i'm going to show the core files as of 3.0 for an answer to the question.

In the footer file add in this code:

src/pwa-studio/packages/venia-concept/src/components/Footer/footer.js

import CmsBlock from '../CmsBlock';

render() {
   ...
   return (
      <footer className={classes.root}>
         ...
         <CmsBlock identifiers={'cms-block-name'} />
         ...
      </footer>
   )
}

This will pull in your cms by it's name into the react component. You can place the component anywhere inside the return statement. If you need to add styling to the component, i would recommend wrapping it and setting a className on the wrapper.

3
  • My question is how can I add Social link in static block in PWA Sep 20, 2019 at 11:33
  • Are you looking to add a link to a cms block? you just have to log into the admin and add it there under content > blocks. Once you have created the block, you can use the code above to have the cms block show inside the footer component (you can use this same method in any other component as well)
    – circlesix
    Sep 20, 2019 at 13:27
  • I did same thing but changes not reflaced. I executed command also : yarn run watch:venia But it's not update changes. May 11, 2021 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.