KeywordLinkz 1.21 Released

by Kai 21. September 2008 20:11

A minor update that fixes a URL target issue in links automatically generated in comments; found by Rory Primrose.  Thanks, Rory!

Here is the update: KeywordLinkz.cs (13.64 kb)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.Net | Keyword Linkz

KeywordLinkz 1.2 Released

by Kai 21. September 2008 15:43

Dave White found an issue in the last version of KeywordLinkz which he pointed out here

Kai I just discovered a slight issue. The code you have doesn't discriminate between text that is stand-alone or embedded in a word. So, I have a keyword which is "me", and if I have the word me then it links properly. However, it also links the word me in "some", "methane" and "improvement" etc.

Was that by design?

No, that wasn't by design. :)

Get the latest version at the Keyword Linkz repository!

Thanks, Dave!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.Net | Keyword Linkz

KeywordLinkz 1.1 Released

by Kai 21. September 2008 03:26

KeywordLinkz had a collision with ResolveLinks, which is the Extension that comes packaged with BlogEngine.Net.  ResolveLinks automagically turns mentions of URLs in comments into actual clickable hyperlinks.  Unfortunately, it doesn't ignore pre-existing hyperlinks.  Since KeywordLinkz generates hyperlinks, ResolveLinks mangled them.  To make sure that everything happens in the right order and that no links get mangled, I rolled the ResolveLinks functionality into the next version of KeywordLinkz.

 To use KeywordLinkz, I suggest you disable the packaged ResolveLinks extension.  KeywordLinkz will now give you that same functionality.  Get the latest file at the Keyword Linkz repository.

Don't forget to disable your ResolveLinks extension if you want to make full use of this one.

There are a few constants in there.

You can set RESOLVE_URLS_IN_COMMENTS = false if you don't want automatic URL resolution in comments.

You can set AUTOLINK_KEYWORDS_IN_COMMENTS = false if you don't automatic key word links in comments.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.Net | Keyword Linkz

Well, that didn't take long...

by Kai 21. September 2008 00:42

I've been using this Post Security Extension that allows you to set privacy settings for posts.  In a nutshell it works by comparing categories assigned to a post to extension settings that map those categories to user roles.  It works pretty well, but I did want to make a few modifications, including

  1. Authors can always see their own posts
  2. Members of role "Administrators" can always see all posts
  3. Comments are now also screened for permissions at Serve time (it was either that or not allow posting comments for posts in restricted categories, which would have had other problems as well).
  4. A user can view the post/comment if they are in ANY of the roles instead of ALL of them.  Originally, the extension only let you see the post if you belonged to ALL the restricted categories.  For example, if I have a post tagged with restricted categories "Friends" and "Family", I intend for the post to be visible by either Friends, or Family.
  5. If you set up a restricted category and don't mention an associated role, it affects NO post, instead of ALL posts. 

The code for the updated PostSecurity extension is at the end of this post.  Even though it's more or less a complete re-write of the original, I didn't change the name of it because it shouldn't be used at the same time as the original extension.

You don't need to do the next part if you're okay with the post/comment references showing up in some places.  In other words, the changes made to the extension do not require the following core code changes.

This extension relies on the BlogEngine.Net event Post.Serving. Unfortunately, BlogEngine.Net doesn't fire that event in every case that post/comment info is displayed to potential readers.  I found that the post is still referenced under the following conditions:

  1. Recent Posts Widget
  2. Recent Comments Widget
  3. Various searches including related posts and standard search

That doesn't really work for me, so even though I didn't really want to do this, I modified the source of BlogEngine.Net to fire the Serving event under those circumstances.  Hopefully I caught them all.

Here are the edits: More...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.Net

Keyword Linkz 1.0 Extension for BlogEngine.Net released

by Kai 20. September 2008 00:31

So, I was talking previously about a spot of trouble I ran in to with the Quicker Links extension for BlogEngine.Net as well as an idea for some additional functionality that Alexander Higgins talked about.  Since I wanted to get my hands dirty with the BlogEngine.Net source anyway, I decided to write an extension to address both items.

Look mah!  Dirty Hands!  :D

I give you Keyword Linkz 1.0, by yours truly.  The intended functionality is as such

  1. Any keywords that you specify in the Extension Settings will automagically be turned into the appropriate links (much like Quick Links)
  2. If you mention any of the CATEGORY names on your site in a post or comment, it will automagically link to the category's page
  3. If you mention any of the TAG names on your site in a post or comment, it will automagically link to the tag's page

It happens in that order of precedence, so if you have a category and a tag with the same title you will get a link to the category page.

Some more points to consider:

  • The extension works for posts and comments
  • The extension is (hopefully) smart enough to ignore all "<>" tags
  • Any pre-existing hyperlinks in your text (i.e. <a href></a>) are (hopefully) ignored
  • The extension never actually saves the modified text (i.e. the links) to the data store.  Instead, it generates the hyperlinks on the fly as the content is being served.  That means if you ever update your keyword list, tags, or categories - all links will automagically be updated "retroactively".  If this becomes a performance issue, I may add some options to specify link generation behavior (i.e. only when a post gets saved).  That would, however, mean that all of your cross-reference links generated by the extension may eventually rot.

This is version 1.0.  While I have done my best to test the extension, there are bound to be issues.  If you use this extension, I would love to hear feedback on performance or any defects you encounter.  If you don't use this extension, but have some ideas on how to improve it, please don't hesitate to tell me.  You won't hurt my feelings. :)

Tell all your buddies.  First time's always free. 

Code attached.  To install, just put the .cs file in your App_Code/Extensions/ folder.  Done.

Get Keyword Linkz Now

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

BlogEngine.Net | Keyword Linkz

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About Me

My name is Kai Steinmann. This is my blog. :)

I'm a video Game Developer by trade.  On my blog you'll find various wanderings about Game Development, Games in general, C# and .NET programming as well as other random stuff that interests me that day. 

Thanks for stopping by.