Create new post
To create a post on Galaxy Social, follow these steps:
-
Create a Branch: Begin by creating a branch in this repository or your forked repository.
-
Add a New File: Within the "posts" folder (or sub-folders), create a new file with the extension ".md" and commit it to your branch.
-
Use the Post Template: Utilize the following template for the post content:
---
media:
- mastodon-eu-freiburg
- matrix-eu-announce
- bluesky-galaxyproject
- linkedin-galaxyproject
mentions:
mastodon-eu-freiburg:
- [email protected]
bluesky-galaxyproject:
- galaxyproject.bsky.social
matrix-eu-announce:
- bgruening:matrix.org
hashtags:
mastodon-eu-freiburg:
- UseGalaxy
- GalaxyProject
- UniFreiburg
- EOSC
- EuroScienceGateway
bluesky-galaxyproject:
- UseGalaxy
- GalaxyProject
- UniFreiburg
- EOSC
- EuroScienceGateway
linkedin-galaxyproject:
- UseGalaxy
- GalaxyProject
- UniFreiburg
- EOSC
- EuroScienceGateway
---
Your text content goes here. (Markdown syntax will not pass to Bluesky, Mastodon, and Linkedin!)
For images just drag and drop them here. they will look like this:
![A](https://example.com/a.jpg)
Notes on the Template:
-
Everything between the two
---
are metatags and should be in YAML format. -
"media" (Required): Ensure the media name is implemented inside the
plugins.yml
. -
"mentions" and "hashtags" (Optional): Follow the specified format as shown in the template.
-
"Your text content goes here." (Required): This is the content that will be posted to social media platforms.
Note that some social media platforms do not support Markdown formatting, so use plain text only.
Dividing long content into multiple threaded posts: when the character limit is reached on a social media, it will be divided into several posts as a thread. You can also define custom breakpoints for splitting the post by inserting 2 empty lines anywhere in the text. The second empty line will simply be removed for media that don't support content splitting.
-
"images" (Optional): You can include images using Markdown format at the end of the file like this:
![Alternative text](Link to the image)
. Alternatively, you can simply drag and drop an image from your PC while adding your file.
-
Create a Pull Request: Once your post is ready, create a pull request to the main branch from another branch or from your fork
-
Preview and Review: After each pull request, the "Create Preview" GitHub action will run. It will generate previews of the content as it would appear on each platform listed under "media" in a comment to the pull request and highlight any errors that need to be fixed before merging.
-
Publish Your Content: Upon merging the pull request, the "Publish Content" GitHub action will run. The results will be added to
processed_files.json
in the processed_files branch.
By following these steps, you can effectively create and publish posts on Galaxy Social.
Expanding the capabilities of Galaxy Social by adding a new social media platform is a straightforward process. Follow these steps to integrate a new platform:
-
Create a Plugin File: Begin by adding a Python file to the
lib/plugins
folder. This file should contain a class with a function namedcreate_post(content, mentions, hashtags, images, alt_texts)
. This function will handle the process of sending announcements to the desired social media platform. -
Update plugins.yml: Next, update the
plugins.yml
file to include the new social media platform. Follow this template:
- name: name_of_the_media
class: file_name.class_name
enabled: true
config:
token: $TOKEN_SAVED_IN_PUBLISH_CONTENT
room_id: "room_id"
Ensure to replace name_of_the_media
with the name of the new platform, and file_name.class_name
with the appropriate file and class name for the plugin.
The name
is then used in the media
tag in the post file (posts/*.md) to determine the social media.
-
Configuration: In the
config
section, specify any required variables for initializing the plugin class. This may include authentication tokens, room IDs, or other platform-specific parameters. Any configuration that needs to be securely passed with GitHub secrets should be prefixed with$
in order to be easily identifiable within the workflow YAML file. -
GitHub Secrets: Add any tokens or variables required for the plugin to GitHub secrets. This ensures sensitive information is securely stored. Refer to GitHub secrets documentation for guidance on creating secrets.
-
Enable the Plugin: Simply set
enabled: true
to enable the new social media platform. This ensures that it will be implemented when creating posts. -
Update publish_content.yml: Finally, update the
publish_content.yml
file to include an environment variable referencing the token saved in GitHub secrets. Use the following template: (Don't put the prefixed$
in here)
---
env:
TOKEN_SAVED_IN_PUBLISH_CONTENT: ${{ secrets.TOKEN_SAVED_IN_GITHUB_SECRETS }}
Replace TOKEN_SAVED_IN_GITHUB_SECRETS
with the name of the secret containing the token for the new social media platform.
By following these steps, you can seamlessly integrate a new social media platform into Galaxy Social, expanding its reach and functionality.
If you need to use the same social media platform with different authentication tokens, you can duplicate the entry in the plugins.yml
file. Follow these steps:
-
Duplicate Entry: Copy the entry for the social media platform in the
plugins.yml
file and paste it below the original entry. -
Update Name and Tokens: Change the name of the duplicated entry to reflect the new configuration, and replace the token with the new authentication token.
-
Configuration: Adjust any other configuration parameters as needed for the duplicated entry.
-
Use Name in Post: Remember that the name you specify in the
plugins.yml
file must also be used within themedia
tag when creating a post. Ensure consistency to link the post with the correct social media platform.
By following these steps, you can effectively duplicate a social media platform with a different token for specific use cases or configurations.
You can execute this repository on your machine by running lib/galaxy_social.py
with the argument --files Files ...
or --folder FOLDER
to process files, or add --preview
to preview the file as markdown. Also there is --json-out processed_files.json
that could be change where to save the json results output.
Remember to add the env variable that needed for each social media seperatly.
- Bluesky
- Mastodon
- Matrix: hashtags are included in the post but have no special function in matrix.
- Slack: mentions and hashtags are not working!
- Linkedin: mentions are not working!