Using ChatGPT to Improve Productivity in DNN Module Development

Using ChatGPT to Improve Productivity in DNN Module Development

Working with ChatGPT is a great way to improve your productivity as a software developer, or even someone just wanting to learn software development. I wanted to highlight one of the ways I use ChatGPT when working with source code for DNN (DotNetNuke) modules that I have maintained for the last 20+ years.

Lately I've been updating the Engage Publish module to better render HTML content that can be indexed and used across the web by adding structured content into the Article Display functionality within the module.

Over the past few weeks I added ld+json support within article display, but I also wanted to update the actual HTML content itself to support structured content formatting/schemas.

To do so I initially created a prompt in ChatGPT where I put the entire HTML source of one of the latest articles here on ChrisHammond.com into the prompt and I asked it to create HTML formatting suggestions. I quickly learned that was a mistake as it started to format EVERYTHING on the page, when really I just wanted to format the article content, not the entire page structure.

Can you look at the HTML for this page and make any SEO related update suggestions for the formatting?

I stopped the ChatGPT response, it was taking forever and multiple "click to continues", and provided this updated prompt:

Just focus on the article's HTML content itself, not the entire HTML page

That responded with a few HTML related changes that I could implement, but overall wasn't quite what I wanted, so I provided the following prompt:

Do you have any structured content suggestions for that HTML?

That got me a little closer, but still primarily focused on the structured content for the ld+json support I had already provided in the module (and was already included in the HTML source I provided on the initial prompt), so I provided an additional prompt:

So I have that structured content in the HEAD tag of the page, but what about in the body? Should I do things like schema, itemprop, etc?

That got me the result I was looking for, ChatGPT suggested schema.org attributes to add to the body of the page. Here's some of the result of that prompt (not the code, but the explanation of what it did):

  • Header Tags:
    • h1 is marked with itemprop="headline".
    • Author is wrapped in span with itemprop="author" and nested itemprop="name".
    • Publication and modification dates are marked with time elements using itemprop="datePublished" and itemprop="dateModified" respectively.
  • Article Body:
    • The main content is wrapped in a div with itemprop="articleBody".
    • Inline elements like links can have itemprop="url".
  • Publisher Information:
    • Publisher information is wrapped in a div with itemprop="publisher" and nested properties for name and logo.

Adding some of those to the code for the Article Display portion of Engage Publish was easy, but then I ran into something a little more complex. This module is rather old, and some of the way things were implemented are a little archaic versus modern web, for example the Date Created and Last Updated attributes on article display come from asp:literal controls, which aren't as simple to add attributes to. Rather than trying to replace how those controls worked, I simply provided ChatGPT with another prompt, asking it to do it for me.

Here's the prompt:

For publish date I currently have this populating:
lblDateCreated.Text = String.Format(Localization.GetString("DateCreated", LocalResourceFile), dateCreated.ToLongDateString());
Change that to your suggested TIME format HTML

And the output which did exactly what I needed:

// Assuming dateCreated is of type DateTime
string formattedDateCreated = dateCreated.ToString("yyyy-MM-ddTHH:mm:ssZ");
lblDateCreated.Text = $"<time itemprop="datePublished" datetime="{formattedDateCreated}">{dateCreated.ToLongDateString()}</time>";

I also realized that the Author control was also a literal where I was simply injecting the name

lblAuthor.Text = article.Author;

So I provided this in a prompt:

My author control is a literal:
lblAuthor.Text = article.Author;
Can you do what I need for that?

Which outputted the following result:

// Assuming article.Author is a string containing the author's name
lblAuthor.Text = $"<span itemprop="author" itemscope itemtype="https://schema.org/Person"><span itemprop="name">{article.Author}</span></span>";

None of these tasks are overly complex for a software developer, but using ChatGPT makes them extremely simple and allows you to move on to the next task even faster.

How are you using ChatGPT to improve?

Recent Comments

There are currently no comments. Be the first to make a comment.

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your comment here.
If you can't type DNNRocks in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond

Chris Hammond is a father, husband, leader, software developer, photographer and car guy. Chris focuses on the latest in technology including artificial intelligence (AI) and has spent decades becoming an expert in ASP.NET and DotNetNuke (DNN) development. You will find a variety of posts relating to those topics here on the website. For more information check out the about Chris Hammond page.

Find me on Twitter, GitHub and LinkedIn.