How do I count all the links in my project?
How do I count all the links in my project?
I'm trying to find a report, method, any way through the Flare app to generate a number of how many links there are in my project. I just need a number such as "there are NN of links in the project". I've looked in the reports, I have looked in the help and there's nothing for "counting links".
thanks in advance.
thanks in advance.
Re: How do I count all the links in my project?
Hello!
If you have Linux command line you can execute this command:
Result number should be devided by 2.
If you don't have Linux you can use Cygwin on Windows.
If you have Linux command line you can execute this command:
Code: Select all
find . -name "*.htm" -exec grep -o "href" '{}' \; | wc -lIf you don't have Linux you can use Cygwin on Windows.
Re: How do I count all the links in my project?
Flare is a Windows application. I run Linux at home. Not sure that I can run Windows-reliant apps (perhaps using Wine or some other emulator) but your method implies that I'm running Linux on my Windows machine.
I am sure I can get wingrep to do what is here, but I was just hoping that Flare had a report that showed number of links. This seems to come up once in a while when QA asks how many links are actually in the help project we're working on currently. Would be nice to just run a report that shows this statistic. I think the reporting went so far to be "in-depth" that it doesn't have basic information available any more.
Thanks for the suggestion (meant to write that originally).
I am sure I can get wingrep to do what is here, but I was just hoping that Flare had a report that showed number of links. This seems to come up once in a while when QA asks how many links are actually in the help project we're working on currently. Would be nice to just run a report that shows this statistic. I think the reporting went so far to be "in-depth" that it doesn't have basic information available any more.
Thanks for the suggestion (meant to write that originally).
Re: How do I count all the links in my project?
No, you should just to install Cygwin (Linux command line emulator for Windows). I have tested this command there.sanjsrik wrote:Flare is a Windows application. I run Linux at home. Not sure that I can run Windows-reliant apps (perhaps using Wine or some other emulator) but your method implies that I'm running Linux on my Windows machine.
I agree it more convenient when Software has all what you need, but sometimes it's impossible.
Note that you can use command line for all tasks what you can imagine.
For example this command can count any tags, words or phrases.
Re: How do I count all the links in my project?
Depends what you class as a 'link', and whether you mean source or output.
For example, if you just want to count hyperlinks and cross-references in your source files, you could just use find to see how many results you get; e.g. find "<MadCap:xref" to count xrefs, or perhaps "<a href" to find links.
If you want to count all links in your output, third-party tools will do that, but it's going to also include breadcrumbs, drop downs, togglers, skin menu/TOC items, etc.
For example, if you just want to count hyperlinks and cross-references in your source files, you could just use find to see how many results you get; e.g. find "<MadCap:xref" to count xrefs, or perhaps "<a href" to find links.
If you want to count all links in your output, third-party tools will do that, but it's going to also include breadcrumbs, drop downs, togglers, skin menu/TOC items, etc.
Re: How do I count all the links in my project?
I still have to ask, why doesn't the software have a basic "links" count with all the parameters mentioned by Dave here? Why has the software gotten SO complicated that the basics are missing?
-
Nita Beck
- Senior Propellus Maximus
- Posts: 3672
- Joined: Thu Feb 02, 2006 9:57 am
- Location: Pittsford, NY
Re: How do I count all the links in my project?
(Preface: Sanjay, I hope you don't take anything I'm about to write personally, and please know that I most certainly respect your viewpoint! I'm engaging in a conversation with a fellow professional about a question he's raised.)
I agree with Dave, that it depends on what you consider a link and whether you're talking source or output.
I have a very large Flare project that probably has thousands of links between files -- from files to stylesheets; from topics to snippets, variable sets, condition sets; from stylesheets to images used as backgrounds as well as to other stylesheets; from targets to TOCs, skins, stylesheets, variable sets, condition sets; and on and on. I cannot see the point at all of knowing how many "links" there are among all the files in my project.
And what if my project were one that used Flare's Runtime Merging feature to pull in output from OTHER Flare projects into order to produce one grand output? Should Flare go out to those "child" projects to fetch their number of "links" too?
Furthermore, even if Flare were able to report on the number of "links" in the project, there will be "uncounted" links until it generates output. Consider how some Flare authors use relationship tables so that Flare will generate links automatically. Flare can't "know" ahead of time how many generated links there might be in generated output because it does not gather all the files to put into an output until it builds (as well as excluding some files from that output because of conditions).
Perhaps you did not mean how many links in your project but instead how many links in generated output. I can (sort of) understand someone caring about how many links there are in generated output, although I can't imagine for what purpose. AFAIK, no, Flare is not programmed to examine output that way.
I dunno, it doesn't at all seem like a basic thing to expect Flare to be able to "count links".
I agree with Dave, that it depends on what you consider a link and whether you're talking source or output.
I have a very large Flare project that probably has thousands of links between files -- from files to stylesheets; from topics to snippets, variable sets, condition sets; from stylesheets to images used as backgrounds as well as to other stylesheets; from targets to TOCs, skins, stylesheets, variable sets, condition sets; and on and on. I cannot see the point at all of knowing how many "links" there are among all the files in my project.
And what if my project were one that used Flare's Runtime Merging feature to pull in output from OTHER Flare projects into order to produce one grand output? Should Flare go out to those "child" projects to fetch their number of "links" too?
Furthermore, even if Flare were able to report on the number of "links" in the project, there will be "uncounted" links until it generates output. Consider how some Flare authors use relationship tables so that Flare will generate links automatically. Flare can't "know" ahead of time how many generated links there might be in generated output because it does not gather all the files to put into an output until it builds (as well as excluding some files from that output because of conditions).
Perhaps you did not mean how many links in your project but instead how many links in generated output. I can (sort of) understand someone caring about how many links there are in generated output, although I can't imagine for what purpose. AFAIK, no, Flare is not programmed to examine output that way.
I dunno, it doesn't at all seem like a basic thing to expect Flare to be able to "count links".
Nita

RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Re: How do I count all the links in my project?
Why would I be offended at your opinion?
Have you seen some of the reports that Flare can produce? They're very in-depth. So, if the software can report on those types of issues within a project, giving me a report that allows me to choose what type of links I'd like to know about doesn't seem all that far-fetched. All your points are valid, and those should be choices in a links report.
I shouldn't have to use an outside utility to see what types of links exist in my project.
Have you seen some of the reports that Flare can produce? They're very in-depth. So, if the software can report on those types of issues within a project, giving me a report that allows me to choose what type of links I'd like to know about doesn't seem all that far-fetched. All your points are valid, and those should be choices in a links report.
I shouldn't have to use an outside utility to see what types of links exist in my project.
-
Nita Beck
- Senior Propellus Maximus
- Posts: 3672
- Joined: Thu Feb 02, 2006 9:57 am
- Location: Pittsford, NY
Re: How do I count all the links in my project?
Thanks. Sometimes I know I am strong in my opinion and I worry that I'll offend others. I try never to be disrespectful and I'm glad that you're not offended.sanjsrik wrote:Why would I be offended at your opinion?
Nita

RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
-
RamonS
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: How do I count all the links in my project?
Out of pure curiosity, what is the value in knowing how many links of any kind there are? Is it better if there are 5000 links versus 500? Maybe there is no such report because the need for such a metric is not obvious.
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U

Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Re: How do I count all the links in my project?
When you have to report on metrics, all companies are different. What you may consider "not important" to your needs is not what all companies consider important to theirs. There are in fact many uses for knowing how many links there are in a project, both by type as well as overall number.
For example, and no, this is not why I need them, when QA goes through help output they might compare how many links there are to how many are reported to make sure that they match, however, I cannot provide that number. This could be a secondary check to know that nothing has been corrupted in the staging to prod server scrape using an RPM and Jenkins to do the job.
Just because you don't consider it important, don't discount it for everyone. Otherwise, why would people like Apple? (no, I have no answer for this one)
For example, and no, this is not why I need them, when QA goes through help output they might compare how many links there are to how many are reported to make sure that they match, however, I cannot provide that number. This could be a secondary check to know that nothing has been corrupted in the staging to prod server scrape using an RPM and Jenkins to do the job.
Just because you don't consider it important, don't discount it for everyone. Otherwise, why would people like Apple? (no, I have no answer for this one)
-
RamonS
- Senior Propellus Maximus
- Posts: 4293
- Joined: Thu Feb 02, 2006 9:29 am
- Location: The Electric City
Re: How do I count all the links in my project?
Thanks for the response. I know others operate differently....still leaves me scratching my head. In 20 years doing QA I never counted links in help. Counting links in the project and in the output only and getting a difference only shows that either old output was used, that either count is wrong, or that it indeed is perfectly fine the way it is due to conditions applied in the target. If there is a need to make the math come out right I'd just put a few nonsensical links in place or take a few out if that makes QA happy. Metrics are nice, but they often do not tell you a lot about quality. What I do is check for dead links and make suggestions to the tech writer on what to link together or not, but that decision is in the end a content/design decision, not a matter of quality. Likewise, as QA I do not dictate if a developer uses a temp table, an array, or an object. As long as the specs and requirements are met the quality goals are mainly achieved. If such a requirement is to have 50123 links in the help I would seriously object to that. Test if the help output is technically sound and content is correct (means that steps 1-5 in a topic are indeed the steps needed to accomplish the described task). More importantly check that the content is clear, helpful, and easy to navigate. Those are subjective assessments that do not come with any metrics (although clarity of text has some means to be measured). If anything I'd analyze link depth and evaluate each case to see if there are reasonable means to flatten the structure as that makes it in some cases easier to navigate, but that depends heavily on the what and why.
Do whatever is needed to satisfy the demands of the product owner. If she/he asks for link counts in the project give Notepad++ a try, you can search across multiple files and use a regex to find any links and request a count. I wouldn't trust that number too much because a good number of links might be generated at build time.
So let me rephrase my statement: Counting links is probably not requested by enough users for MadCap to see a value in creating such a report. How's that?
Do whatever is needed to satisfy the demands of the product owner. If she/he asks for link counts in the project give Notepad++ a try, you can search across multiple files and use a regex to find any links and request a count. I wouldn't trust that number too much because a good number of links might be generated at build time.
So let me rephrase my statement: Counting links is probably not requested by enough users for MadCap to see a value in creating such a report. How's that?
New Book: Creating user-friendly Online Help
Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U

Paperback http://www.amazon.com/dp/1449952038/ or https://www.createspace.com/3416509
eBook http://www.amazon.com/dp/B005XB9E3U
Re: How do I count all the links in my project?
So I remember interviewing many years ago at a company that has its own financial news network whose namesake was the mayor of NYC for a while. Do you know how they count if a tech writer is doing is job? By daily page counts. You are expected to produce X number of pages per day. I scratched my head, thanked them, and never went back.
The statistics people use are sometimes very bizarre. I don't question, just smile and nod.
The statistics people use are sometimes very bizarre. I don't question, just smile and nod.
-
ChoccieMuffin
- Senior Propellus Maximus
- Posts: 2650
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: How do I count all the links in my project?
sanjsrik, did you watch the Analyzer webinar that was just on? You could have asked on there if there was a way. I would have done but got called away by a colleague so didn't hear all the questions at the end.
(And I'm completely with you on the nodding and smiling thing - sometimes that's the only way to keep your sanity.)
(And I'm completely with you on the nodding and smiling thing - sometimes that's the only way to keep your sanity.)
Started as a newbie with Flare 6.1, now using Flare 2024r2.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
-
SteveS
- Senior Propellus Maximus
- Posts: 2090
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: How do I count all the links in my project?
Analyzer does have a report for External Links...
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Re: How do I count all the links in my project?
You could query the SQLite database in the Analyser folder (Content9.s3db). It has an OutgoingLink table that includes a LinkTag column, so you could filter out undesirable link types (like links to images or snippets or whatever) and just count hyperlinks or cross references for example.
I've been using "SQLite Expert" but there are a bunch of other free SQLite browsers out there. Or you can import the table into Excel with the SQLite ODBC drivers at http://www.ch-werner.de/sqliteodbc/.
J
I've been using "SQLite Expert" but there are a bunch of other free SQLite browsers out there. Or you can import the table into Excel with the SQLite ODBC drivers at http://www.ch-werner.de/sqliteodbc/.
J
-
Nita Beck
- Senior Propellus Maximus
- Posts: 3672
- Joined: Thu Feb 02, 2006 9:57 am
- Location: Pittsford, NY
Re: How do I count all the links in my project?
J's idea is an interesting one. But I suspect that it still won't account for all the generated links that are created at build time, such as breadcrumb links, miniTOC links, relationship table links, side menu links (in Top Nav). None of those exist in the source files that Analyzer examines and whose dependencies it tracks.
Nita

RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
Re: How do I count all the links in my project?
True, it comes down to why you're counting links in the first place I guess. If you want to search in the output then it would be easier to use a tool like PowerGREP or similar.
Actually I've never used the database for counting links (not having any reason to do so). The main use I can think of for it is to look for missing links - like images that don't have any links pointing to them (that I can safely delete), or topics that aren't in any toc. I have to admit that I wrote a bunch of sql scripts when I first started using Flare but I very rarely used them (probably because I have a high mess tolerance and I don't feel the need to tidy up my horrible Frankenstein-monster of a project).
J
Actually I've never used the database for counting links (not having any reason to do so). The main use I can think of for it is to look for missing links - like images that don't have any links pointing to them (that I can safely delete), or topics that aren't in any toc. I have to admit that I wrote a bunch of sql scripts when I first started using Flare but I very rarely used them (probably because I have a high mess tolerance and I don't feel the need to tidy up my horrible Frankenstein-monster of a project).
J
Re: How do I count all the links in my project?
I created a utility that recurses on the output of Flare to check for broken links, categorizes the results by internal links, bookmarks, cross-project links, and external links, and outputs an HTML report. It would be fairly trivial to switch it so it just returns the number of links for each, rather than ones that are just broken, if that would be useful. (I suppose, technically, it would work on any local web directory, but the utility is written to account for Flare's nuances.)
It's part of a set of automation utilities for Flare I'm working on for my organization, but nothing really proprietary in this one, if you want to give it a shot.
It's part of a set of automation utilities for Flare I'm working on for my organization, but nothing really proprietary in this one, if you want to give it a shot.
Re: How do I count all the links in my project?
Why not just use MadCap Analyzer? I'm surprised no one else mentioned that. One of its report types is called "External Links". It counts up every link in your Flare project that goes to the World Wide Web. This excludes cross references and hyperlinks to topics within your project. It doesn't seem to take into account what some others have mentioned, such as project merging, etc. but it's not meant to because you run it on a single project.
I don't see a report for counting cross references, but it may be in here and I'm just not seeing it.
The one caveat is that it doesn't count unique links, so if you have ten links to www.amazon.com, it will count it ten times. So I just ran it on my project, and it counts 200 links. I can sort on the links and see that some are repeated 8 times. But since I'm generating seven output types this doesn't bother me much.
Anyway, just thought I would point out this other MadCap tool that may get you closer to where you want.
I don't see a report for counting cross references, but it may be in here and I'm just not seeing it.
The one caveat is that it doesn't count unique links, so if you have ten links to www.amazon.com, it will count it ten times. So I just ran it on my project, and it counts 200 links. I can sort on the links and see that some are repeated 8 times. But since I'm generating seven output types this doesn't bother me much.
Anyway, just thought I would point out this other MadCap tool that may get you closer to where you want.
-
SteveS
- Senior Propellus Maximus
- Posts: 2090
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: How do I count all the links in my project?
See my post (above)...Carlsen wrote:Why not just use MadCap Analyzer? I'm surprised no one else mentioned that. One of its report types is called "External Links". It counts up every link in your Flare project that goes to the World Wide Web. This excludes cross references and hyperlinks to topics within your project. It doesn't seem to take into account what some others have mentioned, such as project merging, etc. but it's not meant to because you run it on a single project.
I don't see a report for counting cross references, but it may be in here and I'm just not seeing it.
The one caveat is that it doesn't count unique links, so if you have ten links to http://www.amazon.com, it will count it ten times. So I just ran it on my project, and it counts 200 links. I can sort on the links and see that some are repeated 8 times. But since I'm generating seven output types this doesn't bother me much.
Anyway, just thought I would point out this other MadCap tool that may get you closer to where you want.
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Re: How do I count all the links in my project?
@SteveS
So short and to the point, I missed it.
So short and to the point, I missed it.
-
SteveS
- Senior Propellus Maximus
- Posts: 2090
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: How do I count all the links in my project?
Yep.Carlsen wrote:@SteveS
So short and to the point, I missed it.
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
-
SteveS
- Senior Propellus Maximus
- Posts: 2090
- Joined: Tue Mar 07, 2006 5:06 pm
- Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
- Contact:
Re: How do I count all the links in my project?
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.