diff --git a/hasjob/socialmedia.py b/hasjob/socialmedia.py index 3ad7e01d..6d294f7c 100644 --- a/hasjob/socialmedia.py +++ b/hasjob/socialmedia.py @@ -102,6 +102,8 @@ def bluesky_post( url: str, location: str | None = None, parsed_location=None, + employer: str | None = None, + employer_url: str | None = None, ): locationtags = [] if parsed_location: @@ -117,12 +119,20 @@ def bluesky_post( locationtags.append(locationtag) maxlength = 300 # Bluesky allows 300 characters + if employer: + maxlength -= len(employer) + 2 # Minus employer name and prefix if locationtags: # Subtract length of all tags, plus length of visible `#`s and one space maxlength -= len(' '.join(locationtags)) + len(locationtags) + 1 content = atproto_client_utils.TextBuilder() content.link(title[: maxlength - 1] + '…' if len(title) > maxlength else title, url) + if employer: + content.text(' –') + if employer_url: + content.link(employer, employer_url) + else: + content.text(employer) if locationtags: for loc in locationtags: content.text(' ') diff --git a/hasjob/views/listing.py b/hasjob/views/listing.py index 281c0e6f..d560ecae 100644 --- a/hasjob/views/listing.py +++ b/hasjob/views/listing.py @@ -1065,10 +1065,12 @@ def confirm_email(domain, hashid, key): ) if app.config['BLUESKY_ENABLED']: bluesky_post.queue( - f'{post.headline} —{post.company_name}', + post.headline, post.url_for(_external=True), post.location, dict(post.parsed_location or {}), + employer=post.company_name, + employer_url=post.url_for('browse', _external=True), ) add_to_boards.queue(post.id) flash(