npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@plonegovbr/volto-network-block

v1.0.0

Published

Volto Social Networks blocks and components

Downloads

117

Readme

NPM Build Status Build Status Build Status

About

The @plonegovbr/volto-network-block package provides components and blocks to connect your Volto site to existing social network profiles.

Blocks

  • Follow Us: Block with links pointing to social network profiles.

Screenshots

Follow Us Block

Installation

New Volto Project

Create a Volto project, install the new add-on and restart Volto:

yarn install
yarn start

Existing Volto Project

If you already have a Volto project, just update package.json:

"addons": [
    "@plonegovbr/volto-network-block"
],

"dependencies": {
    "@plonegovbr/volto-network-block": "*"
}

Configuration

This addon is configured either via backend (the preferred way) or via the Volto registry in the frontend.

Frontend codebase

On your Volto project configuration, update config.settings with a socialNetworks array:

const applyConfig = (config) => {
  config.settings = {
    ...config.settings,
    socialNetworks: [
      {
        id: 'twitter',
        title: 'Twitter',
        icon: 'twitter',
        url: 'https://twitter.com/ploneorgbr/',
      },
      {
        id: 'instagram',
        title: 'Instagram',
        icon: 'instagram',
        url: 'https://www.instagram.com/plonebr/',
      },
    ],
  };
  return config;
};

Each entry in socialNetworks should have the following structure:

{
    id: 'twitter',
    title: 'Twitter',
    icon: 'twitter',
    url: 'https://twitter.com/ploneorgbr/',
},

Backend (via Generic Setup)

On your Python package, add (or edit) the actions.xml file on the default profile to add the networks:

<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
        meta_type="Plone Actions Tool"
        name="portal_actions"
>
  <object meta_type="CMF Action Category"
          name="social_actions"
  >
    <property name="title">Social actions</property>
    <object meta_type="CMF Action"
            name="facebook"
    >
      <property name="title"
      >Facebook</property>
      <property name="description"
      />
      <property name="url_expr">string:https://www.facebook.com/Plone-Brasil-101606785972720</property>
      <property name="link_target" />
      <property name="icon_expr">string:facebook</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>
    <object meta_type="CMF Action"
            name="github"
    >
      <property name="title"
      >GitHub</property>
      <property name="description"
      />
      <property name="url_expr">string:https://github.com/plonegovbr</property>
      <property name="link_target" />
      <property name="icon_expr">string:github</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>
    <object meta_type="CMF Action"
            name="instagram"
    >
      <property name="title"
      >Instagram</property>
      <property name="description"
      />
      <property name="url_expr">string:https://www.instagram.com/plonebr/</property>
      <property name="link_target" />
      <property name="icon_expr">string:instagram</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>
    <object meta_type="CMF Action"
            name="twitter"
    >
      <property name="title"
      >Twitter</property>
      <property name="description"
      />
      <property name="url_expr">string:https://twitter.com/ploneorgbr/</property>
      <property name="link_target" />
      <property name="icon_expr">string:twitter</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>
    <object meta_type="CMF Action"
            name="youtube"
    >
      <property name="title"
      >Youtube</property>
      <property name="description"
      />
      <property name="url_expr">string:https://www.youtube.com/playlist?list=PLGN9BI-OAQkTbVIJRPYpAs1K4hBdkLl10</property>
      <property name="link_target" />
      <property name="icon_expr">string:youtube</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>

  </object>

</object>

In the code above, a new category is created in portal_actions

An entry for a Facebook social network configuration looks like the code below:

    <object meta_type="CMF Action" name="facebook">
      <property name="title">Facebook</property>
      <property name="description" />
      <property name="url_expr">string:https://www.facebook.com/Plone-Brasil-101606785972720</property>
      <property name="link_target" />
      <property name="icon_expr">string:facebook</property>
      <property name="available_expr" />
      <property name="permissions">
        <element value="View" />
      </property>
      <property name="visible">True</property>
    </object>

The name attribute should be unique. This is important if you have more than one profile in a social network.

Also, the important properties are:

  • title: Friendly name to be used for the social network
  • url_expr: URL to the social network profile. Always prefix it with string:
  • icon_expr: Icon to be used for this social network. Always prefix it with string:
  • visible: Should this network be visible on the frontend?

Credits

License

The project is licensed under the MIT license.