Skip to content
Will Strohl edited this page May 5, 2025 · 4 revisions

Upendo.OpenContentHelper

Welcome to the Upendo.OpenContentHelper project!

This DNN extension provides a lightweight, zero-installation solution to dynamically inject <meta> and <link> tags into the <head> of a page using data defined in an OpenContent module.

This project is ideal for:

  • Site admins who want SEO, social media, or favicon metadata managed through content modules
  • Themers and integrators who need tag injection without writing new modules or hacking templates
  • Developers who want a safe, reusable method of injecting dynamic metadata

🧠 What This Actually Does

When combined with a properly configured OpenContent template:

  • The OpenContent module allows administrators and content editors to define structured <meta> and <link> tag data (such as for SEO, authorship, Open Graph, favicons, or canonical URLs).
  • The Upendo.OpenContentHelper theme object locates the relevant OpenContent module on the current page, extracts the stored tag data, validates it, and injects it into the page's <head> section server-side.
  • This allows metadata to be managed like regular content β€” without modifying theme files, core settings, or relying on client-side hacks.

This approach keeps your site's metadata portable, maintainable, and content-managed β€” and is ideal for dynamic sites, marketing campaigns, or editor-driven optimization.


πŸš€ Getting Started

1. Drop the Theme Object into Your Skin

In your DNN theme layout (e.g., default.ascx):

<%@ Register TagPrefix="upendo" TagName="MetaInjector" Src="~/DesktopModules/Upendo.OpenContentHelper/View.ascx" %>
<upendo:MetaInjector runat="server" />

This executes the logic that reads OpenContent data and injects tags.

2. Configure an OpenContent Module

  • Add an OpenContent module to any page where you want metadata managed
  • Set the module title to include the word Meta (e.g., OC: Meta Data Manager)
  • Begin adding tags using the editor.

DEMO VIDEO: How to Edit Page Meta Data in DNN


πŸ”’ Security & Validation

This helper uses the MetaValidationHelper.cs class to protect your site from invalid or malicious input. Highlights:

  • Disallows <, >, and script content in tag values
  • Rejects dangerous schemes like javascript: or data: in href
  • Accepts only known-safe values for rel and name fields
  • Limits field lengths (e.g., max 500 characters for content)
  • Logs only one rejection per page request (prevents log flooding)

πŸ§ͺ Testing & Debugging

  • Rejected inputs are logged using the DNN Event Log (as HOST_ALERT)
  • You can preview data by switching the page with the OpenContent module to edit mode
  • No metadata will be injected if the module is missing or schema is empty

πŸ“¦ Files Included

  • MetaInjector.ascx – skin object UI file
  • MetaInjector.ascx.cs – main logic for locating module, loading data, injecting tags
  • MetaValidationHelper.cs – reusable helper for sanitizing and validating tag data

πŸ“š Related Topics


πŸ™Œ Contributing

We welcome feedback and contributions! To suggest changes, report issues, or submit a PR, visit the GitHub repository.


πŸ’¬ License

This project is provided under the MIT License.