Embedding links in an HTML report

Hello,

How would I go about embedding links <a href> links in an html file with PowerShell. Right now I’m trying this:

function getHackerNews { $hNewsWP = "https://news.ycombinator.com/" $hNewsWP = Invoke-WebRequest -uri $hNewsWP $hackerNewsLinks = $hNewsWP.links | Where-Object {$_.Class -eq "storylink"} | Select-Object -Property innerHTML, @{Name ='href'; expression = {"<a href=`'$($_.href)`'></a>"};} | ConvertTo-Html -Head $Header $hackerNewsLinks | Out-File "C:KitsNews.html" } 

But the link is unclickable and the a href is not being processed as HTML.

https://i.redd.it/k547qsi4qfg31.jpg

If I look at the page source I can see random stuff being added to the a href:

https://i.redd.it/4g4dr0mfqfg31.jpg

Thanks

submitted by /u/EIGRP_OH
[link] [comments]

Leave a Reply