Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating mastodon links and page #39

Merged
merged 3 commits into from
Nov 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ menu:
url: /news/
- title: Discussion
external_url: https://github.com/hpc-social/hpc-social.github.io/discussions
- title: Join Us On Mastodon
external_url: https://mast.hpc.social/about
- title: Mastodon
url: /projects/mastodon/

# Add links to the footer.
legal:
Expand Down Expand Up @@ -316,6 +316,7 @@ twitter:
social:
name: HPC Social
github: hpc-social
mastodon: https://mast.hpc.social/about
links:
- https://twitter.com/hpc_social
- https://github.com/hpc-social
Expand Down
2 changes: 2 additions & 0 deletions _data/authors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ author1:
github: hpc-social
email: [email protected]
twitter: hpc_social
mastodon: https://mast.hpc.social/about

# youtube: xxxxxxxxxxxxxxxxxxx
# resume: /assets/resume.pdf
# facebook: nick.engmann
Expand Down
8 changes: 7 additions & 1 deletion _includes/components/social-list-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@
{% assign icon = data_social.icon | default:'icon-link' %}
{% assign app = data_social.append %}
{% assign prep = data_social.prepend %}
{% assign target = "_blank" %}

{% unless data_social %}
{% if platform == "email" %}
{% assign name = "Email" %}
{% assign icon = "icon-mail" %}
{% assign prep = "mailto:" %}
{% assign target = "_self" %}
{% elsif platform == "mastodon" %}
{% assign name = "Mastodon" %}
{% assign icon = "mastodon-icon" %}
{% assign prep = "" %}
{% elsif platform == "twitter" %}
{% assign name = "Twitter" %}
{% assign icon = "icon-twitter" %}
Expand All @@ -32,7 +38,7 @@
{% endif %}

<li>
<a href="{{ url }}" title="{{ name }}" class="no-mark-external">
<a target="{{ target }}" href="{{ url }}" title="{{ name }}" class="no-mark-external">
<span class="{{ icon }}"></span>
<span class="sr-only">{{ name }}</span>
</a>
Expand Down
81 changes: 6 additions & 75 deletions _projects/mastodon.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ accent_image:

### hpc.social on Mastodon

<img src="https://img.shields.io/badge/dynamic/json?label=Accounts&query=stats.user_count&url=https%3A%2F%2Fmast.hpc.social%2Fapi%2Fv1%2Finstance"/>
<a style="float:left" type="button" class="btn btn-primary external" target="_blank" href="https://mast.hpc.social/about">Join Us On Mastodon</a>

<img style="float:right" src="https://img.shields.io/badge/dynamic/json?label=Accounts&query=stats.user_count&url=https%3A%2F%2Fmast.hpc.social%2Fapi%2Fv1%2Finstance"/><br>

<br>

We are proud to provide the HPC community with a Mastodon instance at
<a class="link" href="https://mast.hpc.social" target="_blank">mast.hpc.social</a>!
Expand All @@ -39,77 +43,4 @@ Here are some getting-started links:

* Privacy policy: [https://mast.hpc.social/privacy-policy](https://mast.hpc.social/privacy-policy) and see also links in the "About" starting page.

The policy documents linked here are served from <a href="https://github.com/hpc-social/mastodon-policies" target="_blank">hpc-social/mastodon-policies</a> on GitHub. You can ask questions, or make contributions or suggestions for changes there.

<div id="server-policy" style="display:none"></div>

<br><br>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/showdown.min.js"></script>

<script>
function getImages(string) {
const imgRex = /<img.*?src="(.*?)"[^>]+>/g;
const images = [];
let img;
while ((img = imgRex.exec(string))) {
images.push(img[1]);
}
return images;
}

function getLinks(string) {
const imgRex = /href="(.*?)"/g;
const links = [];
let img;
while ((img = imgRex.exec(string))) {
links.push(img[1]);
}
return links;
}

function basename(str) {
var base = new String(str).substring(str.lastIndexOf('/') + 1);
if(base.lastIndexOf(".") != -1)
base = base.substring(0, base.lastIndexOf("."));
return base;
}

$(document).ready(function(){

url = "https://raw.githubusercontent.com/hpc-social/mastodon-policies/main/README.md"
$.get(url, function(data) {
var converter = new showdown.Converter({tables: true}),
html = converter.makeHtml(data);

// Convert top level headings to next level for site
html = html.replace("<h1 ", "<h2 ")

// Find all relative markdown links and replace with pages
var links = getLinks(html)
for (var i = 0; i < links.length; i++) {
link = links[i];

// Relative directory or markdown path (link to page)
if (!link.startsWith("http") && !link.startsWith('mailto:')) {
html = html.replace(link, "https://github.com/hpc-social/mastodon-policies/tree/main/" + link)
}
}

// Relative images need to be replaced by a raw GitHub url
// We will need to do this for other relative paths too
var images = getImages(html)
for (var i = 0; i < images.length; i++) {
image = images[i];
if (!image.startsWith("http")) {
html = html.replace(image, "https://raw.githubusercontent.com/hpc-social/mastodon-policies/main/" + image);
}
}

$('#server-policy').html(html)
$('#server-policy').show();
});

});
</script>
You can read more about our policy at <a href="https://github.com/hpc-social/mastodon-policies" target="_blank">hpc-social/mastodon-policies</a> on GitHub. You can ask questions, or make contributions or suggestions for changes there.
4 changes: 4 additions & 0 deletions assets/icomoon/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,7 @@
.icon-history:before {
content: "\1f552";
}
/* explicitly different name so it doesn't match icon-* pattern*/
.mastodon-icon:before {
content: url(/assets/icons/mastodon.svg);
}
65 changes: 65 additions & 0 deletions assets/icons/mastodon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We will be updating this site in the coming months - stay tuned!
* [Projects]{:.heading.flip-title} --- Maintained by the community.
* [Discussions]{:.heading.flip-title} --- Community Discussion
* [News]{:.heading.flip-title} --- Latest news and announcements.
* [Mastodon]{:.heading.flip-title} --- Learn how to join us on Mastodon.

{:.related-posts.faded}

Expand All @@ -24,3 +25,4 @@ We will be updating this site in the coming months - stay tuned!
[projects]: projects/
[news]: news/
[discussions]: https://github.com/hpc-social/hpc-social.github.io/discussions
[mastodon]: projects/mastodon/