From d174fedfc983f23bae7633978835b480b30c88d6 Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Tue, 12 May 2026 13:21:46 -0700
Subject: [PATCH 1/6] fix: Get-OpenGraph casting cached returns ( Fixes #20 )
---
Commands/Get-OpenGraph.ps1 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Commands/Get-OpenGraph.ps1 b/Commands/Get-OpenGraph.ps1
index e21598c..fde063b 100644
--- a/Commands/Get-OpenGraph.ps1
+++ b/Commands/Get-OpenGraph.ps1
@@ -24,7 +24,7 @@ function Get-OpenGraph
param(
# The URL that may contain Open Graph metadata
[Parameter(ValueFromPipelineByPropertyName)]
- [Uri]
+ [string]
$Url,
# A dictionary of additional Open Graph metadata to include in the result
@@ -51,7 +51,7 @@ function Get-OpenGraph
$openGraphMetadata = [Ordered]@{PSTypeName='OpenGraph'}
if ($Url) {
if ($script:OpenGraphCache[$url] -and -not $Force) {
- return $script:OpenGraphCache[$url]
+ return ([PSCustomObject]$script:OpenGraphCache[$url])
}
$restResponse = Invoke-RestMethod -Uri $Url
foreach ($match in $metaRegex.Matches("$restResponse")) {
From 0968b6af2883dc634d6b02c05e124a7b3e750ba9 Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Wed, 13 May 2026 16:04:22 -0700
Subject: [PATCH 2/6] feat: Get-OpenGraph parameter flexibility ( Fixes #21 )
---
Commands/Get-OpenGraph.ps1 | 88 +++++++++++++++++++++++++++++---------
1 file changed, 68 insertions(+), 20 deletions(-)
diff --git a/Commands/Get-OpenGraph.ps1 b/Commands/Get-OpenGraph.ps1
index fde063b..1ffffb8 100644
--- a/Commands/Get-OpenGraph.ps1
+++ b/Commands/Get-OpenGraph.ps1
@@ -22,6 +22,13 @@ function Get-OpenGraph
[Alias('openGraph','ogp')]
[CmdletBinding(PositionalBinding=$false)]
param(
+ # A list of any arguments.
+ # This allows the command to take natural input.
+ [Parameter(ValueFromRemainingArguments)]
+ [Alias('Argument','Arguments','Args')]
+ [PSObject[]]
+ $ArgumentList,
+
# The URL that may contain Open Graph metadata
[Parameter(ValueFromPipelineByPropertyName)]
[string]
@@ -35,7 +42,13 @@ function Get-OpenGraph
# If set, forces the function to retrieve the Open Graph metadata even if it is already cached.
[Parameter(ValueFromPipelineByPropertyName)]
[switch]
- $Force
+ $Force,
+
+ # Any number of input objects
+ [Parameter(ValueFromPipeline)]
+ [Alias('Input')]
+ [PSObject[]]
+ $InputObject
)
begin {
@@ -43,33 +56,68 @@ function Get-OpenGraph
$metaRegex = [Regex]::new('','IgnoreCase','00:00:00.1')
if (-not $script:OpenGraphCache) {
$script:OpenGraphCache = [Ordered]@{}
- }
+ }
}
process {
- # Declare an empty object to hold the Open Graph metadata
- $openGraphMetadata = [Ordered]@{PSTypeName='OpenGraph'}
if ($Url) {
- if ($script:OpenGraphCache[$url] -and -not $Force) {
- return ([PSCustomObject]$script:OpenGraphCache[$url])
- }
- $restResponse = Invoke-RestMethod -Uri $Url
- foreach ($match in $metaRegex.Matches("$restResponse")) {
- $matchXml = "$match" -as [xml]
- if ($matchXml.meta.property -and $matchXml.meta.content) {
- $openGraphMetadata[$matchXml.meta.property] = $matchXml.meta.content
- }
- }
- $script:OpenGraphCache[$url] = $openGraphMetadata
+ $argumentList = @($argumentList) + $url
}
if ($Data) {
- foreach ($key in $Data.Keys) {
- $openGraphMetadata[$key] = $Data[$key]
- }
+ $argumentList = @($argumentList) + $Data
+ }
+ if ($InputObject) {
+ $ArgumentList = @($ArgumentList) + $InputObject
}
- if (-not $openGraphMetadata.Count) { return }
+ :nextArgument foreach ($argument in $argumentList) {
+ # Declare an empty object to hold the Open Graph metadata
+ if (-not $argument) { continue }
+ $openGraphMetadata = [Ordered]@{PSTypeName='OpenGraph'}
+ $url, $data = $null, $null
+
+ if ($argument -as [uri]) {
+ $url = $argument -as [uri]
+ } elseif ($argument -is [Collections.IDictionary]) {
+ $data = $argument
+ } else {
+ Write-Warning "Only [uri] and [Collections.IDictionary] supported: $argument"
+ continue nextArgument
+ }
+
+ if ($Url) {
+ if ($script:OpenGraphCache[$url] -and -not $Force) {
+ foreach ($key in $script:OpenGraphCache[$url].Keys) {
+ $openGraphMetadata[$key] =
+ $script:OpenGraphCache[$url][$key]
+ }
+ ([PSCustomObject]$script:OpenGraphCache[$url])
+ continue nextArgument
+ }
- [PSCustomObject]$openGraphMetadata
+ $restResponse = Invoke-RestMethod -Uri $Url
+
+ foreach ($match in $metaRegex.Matches("$restResponse")) {
+ $matchXml = "$match" -as [xml]
+ if ($matchXml.meta.property -and $matchXml.meta.content) {
+ $openGraphMetadata[$matchXml.meta.property] = $matchXml.meta.content
+ }
+ }
+
+ $script:OpenGraphCache[$url] = $openGraphMetadata
+ }
+
+ if ($Data) {
+ foreach ($key in $Data.Keys) {
+ $openGraphMetadata[$key] = $Data[$key]
+ }
+ }
+
+ if (-not $openGraphMetadata.Count) {
+ continue nextArgument
+ }
+
+ [PSCustomObject]$openGraphMetadata
+ }
}
}
\ No newline at end of file
From c1d5ca91018d19f9d11b8b1bcbb740b010b38a49 Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Wed, 13 May 2026 16:37:58 -0700
Subject: [PATCH 3/6] feat: Test-OpenGraph ( Fixes #22 )
---
Commands/Get-OpenGraph.ps1 | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/Commands/Get-OpenGraph.ps1 b/Commands/Get-OpenGraph.ps1
index 1ffffb8..5e54492 100644
--- a/Commands/Get-OpenGraph.ps1
+++ b/Commands/Get-OpenGraph.ps1
@@ -17,11 +17,11 @@ function Get-OpenGraph
'https://cnn.com/',
'https://msnbc.com/',
'https://fox.com/' |
- Get-OpenGraph
+ Get-OpenGraph
#>
- [Alias('openGraph','ogp')]
+ [Alias('openGraph','ogp','Test-OpenGraph', 'Test-OGP')]
[CmdletBinding(PositionalBinding=$false)]
- param(
+ param(
# A list of any arguments.
# This allows the command to take natural input.
[Parameter(ValueFromRemainingArguments)]
@@ -56,10 +56,11 @@ function Get-OpenGraph
$metaRegex = [Regex]::new('','IgnoreCase','00:00:00.1')
if (-not $script:OpenGraphCache) {
$script:OpenGraphCache = [Ordered]@{}
- }
+ }
}
process {
+ # Turn any of our strongly bound parameters into arguments
if ($Url) {
$argumentList = @($argumentList) + $url
}
@@ -113,7 +114,11 @@ function Get-OpenGraph
}
}
+ # If there was no metadata
if (-not $openGraphMetadata.Count) {
+ # output false (so `Test-` verb scenarios are met)
+ $false
+ # and continue to the next argument.
continue nextArgument
}
From 11760b0701b28814b891a26002264b1ccbdd2ba7 Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Thu, 14 May 2026 12:15:14 -0700
Subject: [PATCH 4/6] feat: Get-OpenGraph unclosed meta tags support ( Fixes
#23 )
---
Commands/Get-OpenGraph.ps1 | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Commands/Get-OpenGraph.ps1 b/Commands/Get-OpenGraph.ps1
index 5e54492..fd0653f 100644
--- a/Commands/Get-OpenGraph.ps1
+++ b/Commands/Get-OpenGraph.ps1
@@ -17,7 +17,9 @@ function Get-OpenGraph
'https://cnn.com/',
'https://msnbc.com/',
'https://fox.com/' |
- Get-OpenGraph
+ Get-OpenGraph
+ .EXAMPLE
+ OpenGraph https://posh.pckt.blog/static-sites-are-simple-6u51kgj
#>
[Alias('openGraph','ogp','Test-OpenGraph', 'Test-OGP')]
[CmdletBinding(PositionalBinding=$false)]
@@ -53,7 +55,7 @@ function Get-OpenGraph
begin {
# Make a regex to match meta tags
- $metaRegex = [Regex]::new('','IgnoreCase','00:00:00.1')
+ $metaRegex = [Regex]::new('','IgnoreCase','00:00:00.1')
if (-not $script:OpenGraphCache) {
$script:OpenGraphCache = [Ordered]@{}
}
@@ -99,10 +101,14 @@ function Get-OpenGraph
$restResponse = Invoke-RestMethod -Uri $Url
foreach ($match in $metaRegex.Matches("$restResponse")) {
- $matchXml = "$match" -as [xml]
+ $matchXml = (
+ # close unclosed `` tags.
+ "$match" -replace '/?>$','/>'
+ ) -as [xml]
+
if ($matchXml.meta.property -and $matchXml.meta.content) {
$openGraphMetadata[$matchXml.meta.property] = $matchXml.meta.content
- }
+ }
}
$script:OpenGraphCache[$url] = $openGraphMetadata
From 67652092ce27e48ad353c9ac1856222d116f7fbc Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Thu, 14 May 2026 12:17:44 -0700
Subject: [PATCH 5/6] release: OpenGraph 0.1.1
Updating manifest and changelog
---
CHANGELOG.md | 17 +++++++++++++++++
OpenGraph.psd1 | 17 ++++++++++-------
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8720e84..f93744f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,20 @@
+## OpenGraph 0.1.1
+
+* `Get-OpenGraph` now supports unclosed `` tags (#23)
+* `Test-OpenGraph` and `Test-OGP` are aliases of `Get-OpenGraph` (#22).
+ * Additionally, `Get-OpenGraph` now outputs `$false` when no OpenGraph tags are found.
+* `Get-OpenGraph` now accepts any pipeline input and number of arguments (#21)
+* `Get-OpenGraph` correctly outputs cached results (#20)
+
+---
+
+## OpenGraph 0.1
+
+* `OpenGraph.ToString()` now returns HTML (#10)
+* `Get-OpenGraph` now caches results (#11)
+
+---
+
## OpenGraph 0.0.1
* Initial Release of OpenGraph Module (#1)
diff --git a/OpenGraph.psd1 b/OpenGraph.psd1
index ff3ec4b..db1e098 100644
--- a/OpenGraph.psd1
+++ b/OpenGraph.psd1
@@ -1,13 +1,13 @@
@{
RootModule = 'OpenGraph.psm1'
- ModuleVersion = '0.1'
+ ModuleVersion = '0.1.1'
GUID = 'be4e4070-1ea6-4a2e-8b6a-c6b7755e5ace'
- Author = 'JamesBrundage'
+ Author = 'James Brundage'
CompanyName = 'Start-Automating'
- Copyright = '(c) 2025 Start-Automating'
+ Copyright = '(c) 2025-2026 Start-Automating'
Description = 'Get OpenGraph with PowerShell'
FunctionsToExport = 'Get-OpenGraph'
- AliasesToExport = 'OpenGraph', 'ogp'
+ AliasesToExport = 'OpenGraph', 'ogp', 'Test-OpenGraph', 'Test-OGP'
TypesToProcess = 'OpenGraph.types.ps1xml'
PrivateData = @{
PSData = @{
@@ -18,10 +18,13 @@
> Like It? [Star It](https://github.com/PowerShellWeb/OpenGraph)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)
-## OpenGraph 0.1
+## OpenGraph 0.1.1
-* `OpenGraph.ToString()` now returns HTML (#10)
-* `Get-OpenGraph` now caches results (#11)
+* `Get-OpenGraph` now supports unclosed `` tags (#23)
+* `Test-OpenGraph` and `Test-OGP` are aliases of `Get-OpenGraph` (#22).
+ * Additionally, `Get-OpenGraph` now outputs `$false` when no OpenGraph tags are found.
+* `Get-OpenGraph` now accepts any pipeline input and number of arguments (#21)
+* `Get-OpenGraph` correctly outputs cached results (#20)
---
From 4017155d606e6bb26ae2514c11d6797395e17a64 Mon Sep 17 00:00:00 2001
From: James Brundage <+@noreply.github.com>
Date: Thu, 14 May 2026 12:22:44 -0700
Subject: [PATCH 6/6] release: OpenGraph 0.1.1
Updating README and cleaning up manifest
---
OpenGraph.psd1 | 2 --
README.md | 17 ++++++++++-------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/OpenGraph.psd1 b/OpenGraph.psd1
index ff031ca..1742329 100644
--- a/OpenGraph.psd1
+++ b/OpenGraph.psd1
@@ -17,8 +17,6 @@
ReleaseNotes = @'
## OpenGraph 0.1.1
-## OpenGraph 0.1.1
-
* `Get-OpenGraph` now supports unclosed `` tags (#23)
* `Test-OpenGraph` and `Test-OGP` are aliases of `Get-OpenGraph` (#22).
* Additionally, `Get-OpenGraph` now outputs `$false` when no OpenGraph tags are found.
diff --git a/README.md b/README.md
index f0f5707..d786259 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ Import-Module OpenGraph -PassThru
You can also clone the repo and import the module locally:
~~~PowerShell
-git clone https://github.com/PoshWeb/OpenGraph
+git clone https://github.com/PowerShellWeb/OpenGraph
cd ./OpenGraph
Import-Module ./ -PassThru
~~~
@@ -40,10 +40,11 @@ This function retrieves the Open Graph metadata from a given URL and returns it
|Name|Type|Description|
|-|-|-|
-|Url|Uri|The URL that may contain Open Graph metadata|
-|Html|String|Any HTML that may contain open graph metadata.|
+|ArgumentList|PSObject[]|A list of any arguments.
This allows the command to take natural input.|
+|Url|String|The URL that may contain Open Graph metadata|
|Data|IDictionary|A dictionary of additional Open Graph metadata to include in the result|
|Force|SwitchParameter|If set, forces the function to retrieve the Open Graph metadata even if it is already cached.|
+|InputObject|PSObject[]|Any number of input objects|
##### Examples
###### Example 1
@@ -57,8 +58,10 @@ Get-OpenGraph -Url https://abc.com/
'https://fox.com/' |
Get-OpenGraph
~~~
-#### Links
-* [https://ogp.me/](https://ogp.me/)
+###### Example 3
+~~~PowerShell
+
+~~~
## Types
### OpenGraph
#### Members
@@ -66,6 +69,6 @@ Get-OpenGraph -Url https://abc.com/
|-|-|
|[ToString](Types/OpenGraph/ToString.ps1)|ScriptMethod|
|[get_HTML](Types/OpenGraph/get_HTML.ps1)|ScriptProperty|
-> (c) 2025 Start-Automating
+> (c) 2025-2026 Start-Automating
-> [LICENSE](https://github.com/PoshWeb/OpenGraph/blob/main/LICENSE)
+> [LICENSE](https://github.com/PowerShellWeb/OpenGraph/blob/main/LICENSE)