Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Tag post author in tweet #670

Open
lothrop opened this issue Jun 16, 2020 · 14 comments
Open

Tag post author in tweet #670

lothrop opened this issue Jun 16, 2020 · 14 comments

Comments

@lothrop
Copy link
Contributor

lothrop commented Jun 16, 2020

Is your feature request related to a problem? Please describe.
I never notice when one of my blog posts gets featured by Planet Xamarin.

Describe the solution you'd like
It would be nice if the tweet announcing the new post would contain my Twitter handle so I can get notified of its existence and can further push the tweet's visibility.

Describe alternatives you've considered
Adding a column in TweetDeck to show me only those tweets.

Additional context
I can implement a pull request if this is desired.

@Cheesebaron
Copy link
Member

@jamesmontemagno is running the IFTTT bot. There might be some limitations to what it can do.

@jamesmontemagno
Copy link
Member

Just a limitation of IFTTT as it just reads the RSS feed. We could setup a function and do tweets and such, but seems like a bunch of work and have to register with twitter dev and such....

@lothrop
Copy link
Contributor Author

lothrop commented Jun 18, 2020

Ah, I see. I originally thought the tweet was sent from the code in this repository and that has the Twitter handle.

@jamesmontemagno
Copy link
Member

yeah, just an IFTTT on an RSS feed :(

@Cheesebaron
Copy link
Member

@jamesmontemagno if we enriched the feed somehow for each of the Entries in the RSS, would that help fishing out the Author twitter handle.

@jamesmontemagno
Copy link
Member

I am sure if we added @ whatever in the title it would work technically.

@Cheesebaron
Copy link
Member

@jamesmontemagno what do you do when the title is too long? Truncate it? Should we somehow ensure that it fits a tweet?

@jamesmontemagno
Copy link
Member

hmmmmmm I can't imaging titles of blogs being more than 280 characters.

If the title was:

"Title + by @ twitter" handle then it would show up.

If they dont' have a twitter handle then nothing would change there.

@lothrop
Copy link
Contributor Author

lothrop commented Jul 6, 2020

In the Atom feed https://www.planetxamarin.com/feed, the author is in in a contributor tag:

<a10:contributor>
  <a10:name>Allan Ritchie</a10:name>
  <a10:uri>https://allancritchie.net/</a10:uri>
  <a10:email>allan.ritchie@example.com</a10:email>
</a10:contributor>

Could we perhaps add another tag as extensionElement as defined in https://tools.ietf.org/html/rfc4287#section-6.4 to add the Twitter handle? And could we then use that information from IFTTT?

@saamerm
Copy link
Contributor

saamerm commented Jul 20, 2020

So based on the discussion and my analysis, if we make the following change in the PreviewViewModel:

var titleSuffix = string.IsNullOrEmpty(author.TwitterHandle) 
					? string.Empty
					: ", by @" + author.TwitterHandle;

var previewItem = new PreviewModelItem
{
	AuthorName = authorName,
	Gravatar = author?.GravatarImage(),
	Title = item.Title.Text + titleSuffix,
	Link = link,
	Body = html.Sanitize(),
	PublishDate = item.PublishDate.Humanize()
};

It would that look like this on Twitter and PlanetXamarin.com/preview:

Generating beautiful frames for your iOS & Android screenshots instantly, by @saamerm

I added the IsNullOrEmpty check to make sure that there is a twitter handle value, as I noticed several users not having that property populated.

@saamerm
Copy link
Contributor

saamerm commented Jul 20, 2020

Let me know if you guys are ok with that or I can update my PR for this @Cheesebaron @jamesmontemagno @lothrop

@Cheesebaron
Copy link
Member

Cheesebaron commented Jul 20, 2020

@saamerm Why are you changing the preview model? It is only used here: https://www.planetxamarin.com/preview not for the feed itself.

In the case of the preview. I would rather have the author name go to their blog/social. However, it is irrelevant from the actual contents of the feed which is being discussed here.

@saamerm
Copy link
Contributor

saamerm commented Jul 22, 2020

@Cheesebaron ah yes you are right. I just realized that it's a lot more complicated while trying to fix my PR.
You'd basically need to create a GetTwitterHandle() and iterate through each of the orderedItems in line 168, possibly

foreach (var orderedItem in orderedItems)
{
    // The Title property is not a plain string, it is of type TextSyndicationContent, and the Text property of Title is read-only
    orderedItem.Title = new TextSyndicationContent(orderedItem.Title.Text + GetTwitterHandle(orderedItem.Authors.FirstOrDefault().Name));
}

Based on my parsing of the planetxamarin feed, there is no property that could be used to match the author in our solution, to the feed item, except the Author's Name.
So, my solution would only work if the Name property returned in each RSS item (represented by orderedItem), resembled the name in our solution, which is not true always. Does that make sense?

Keeping that in mind, it would be a lot easier to match the author with the feed item if we could store a users link prefix. Because we would be able to match whether the feed item link url, contains the link prefix for that author, and then display the twitter handle accordingly.

@Cheesebaron
Copy link
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants