Search specific document on documentLibrary of alfresco - alfresco

System can automatically find that particular document and highlight it, if this document is available on first page of pager.
http://ZZZZZZZZZZ:10080/share/page/site/my-site/documentlibrary?file=IFTF_Ten-Year%20Forecast%20-%20Perspectives%202008_04-2008.pdf#filter=path|a.%20Secondary%20Research/Themen/01.%20Macro%20Environment/Future%20Trends.
but if i search some particular document which may be on other page, it is not position correctly.
i need way to do that? this is my link to click
<a target='_blank' title='${msg("label.open_folder")}' id="yui-gen112" href="/share/page/site/${item.site.shortName!''}/documentlibrary?file=${item.encodedName}#filter=path|${item.path!''}">${item.path!''}</a>

You're right that the file param only highlights the document if it appears on the current page - it's a client side highlight and entirely isolated from pagination controls.
It sounds like you're trying to deep link to whichever document library page a given document appears on and highlight that document. I don't think that's possible: the page the document is on may change when content gets added and deleted and may vary from user to user if they modify their individual sort order.
This may not be the answer you're looking for, but if you want to link to a specific document, then your best bet is probably to link to the Document Details page, which has the url format:
/share/page/site/${item.site.shortName}/document-details?nodeRef=${item.nodeRef}

Related

google analytics event tracking for PDF downloads, Generic approach

I need to implement the GA tracking event for PDF file downloads, For that had searched a lot and found out many code where i can add some code to links and track them from GA's content section, But the problem is I do have a lot of PDF link on the page and don't want to edit every link and I want the code to be generic for future uploaded links also.
So what would be the best approach for this task, Any referral links would do or any code would be highly appreciated .
Thanks in advance.
You can explore the use of Google Tag Manager, where you can create a generic tag that will return to you information for each individual link. GTM uses things called "macros" which is like a template that returns useful information including the clicked element's ID, or pathname (which in your case for the PDF files, would all be different). So in this way, you would only need to call this macro each time a PDF file is clicked. No coding is involved using this standard approach through GTM. Here's a link to a descriptive explanation: http://porcelainduck.com/2014/03/track-pdf-downloads-google-tag-manager/. You can see that it uses the {{element URL}} macro that returns the PDF's unique URL. GTM not only applies to current links, but also all future links.
Based on the tags which you've used to mark your question with you're using C#, ASP.NET
If that's the case, can't you create a base page that on rendering replaces all the
I would recommend adding a click event with JQuery to all links or all links inside the download widget class. Inside the click handler I would then grab the link text and use that as part of the Google analytics event you fire.

SDL Tridion Schema Field "List of Links" Options

I'm looking to create an SDL Tridion schema with a list of repeatable links while avoiding multiple fields per link.
Hyperlink
In a rich text field I have the following options for creating a hyperlink:*
Component
Anchor
http://
mailto:
Other
When content authors create one of these hyperlinks, they have the option to select linked (visible) text as well as title and target attributes that function like typical HTML hyperlinks.
"Richtext" means a Text field with Height of the Text Area = at least 2 rows with Allow Rich Text Formatting selected.
Single Schema Field Link
When creating a single schema field, I see these options:
External Link (author options will include http://, mailto, Other)
Multimedia Link
Component Link (which can allow Multimedia Values)
Current Ideas
The best out-of-the-box (OOTB) setups I've found for this "list of links" is either offering:
a single 2-line RTF with instructions to create a hyperlink (of any type) in that field
separate fields for each type as well as additional fields for display name, target, and title (where the fields are assembled through template code), authors fill in only one of the fields (component link or external)
Question
Is there a way in the schema form designer, by updating the schema source, or through code to offer the same (RTF) hyperlink drop-down options, but in a single field? I could be missing something, but recognize this scenario isn't supported OOTB.
One question we are missing here is to consider if those links are going to be used somewhere else individually. If that's the case, multiple components would be my first choice, so we can reuse each component several times.
If you are planning to allow the editor to create a list of links that they are only going to use in a given component (not reusable), well, you have all the options mentioned in the previous answers.
To give you an idea on what's the best approach (in my humble opinion) here are things to consider:
Individual Components per link: use this approach if links are reusable.
Using embedded schemas (with the link structure) so this approach can be used in different component types (schemas)
Custom URL / Single Line Text Field: it requires an additional development effort and it is very unlikely you will keep the hard-link-references when creating internal links. As you know SDL Tridion keeps a reference to the tcm id in order to resolve links, trigger publishing, etc..
Custom URL / 2 Lines RTF: It will do the job, but you need to make sure you disable all the other RTF options from the Ribbon Tool Bar within the Schema RTF options, so you meke sure that the editors can only create links. Also, you might need to consider to add an XSLT filter to check if the edtiors entered something more than just links. These links are not reusable.
In general if you implement something custom (GUI extension + Custom URL) keep in mind all the TRIDION CMS concepts, like blueprinting (what happens when the link is inherited down), where used, etc...
My recommendation has always been to use Separated Components, but be careful with the link propagation when publishing...
I have seen this case at customers. If they consider less development effort, the idea of having a multiple embedded field is good.
You can have it as:
[text] Link Text
[Component Link] Link to anything
You would need an extra Content schema for External Links, like:
[External Link] Url
[text] target
[any extra option you need]
This means the editor would need to create a new External Link Component every time they create an external link. It is extra work, but it can also mean easier maintenance on the use of external urls within their site.
Lastly, the editor would just add multiple Component Links, those being of schema External Link of any other. It will be the template code which checks on the schema of the linked Component and add the code accordingly.
XML Name Description Field Type
[text] Text Text
[title] Title Text
[static_url] External URL Text
[component] Internal URL Component Link
In the field description for "External URL" and "Internal URL" you could add a comment to make sure that the editor doesn't get confused, only one of these two fields should be filled in. From the component, its ID can be used to create the dynamic link in the DWT. This solution has no development effort and for the editor is pretty much as intuitive as it can get. Of course this would be a multivalue embedded schema field inside the Links schema.
This use-case might work using a Custom URL field and maybe a GUI extension. The idea is to have a Custom URL that opens a popup (which might be a GUI extension). In that popup, you would select/construct your link (maybe using the same options as a normal RTF link - Component, Anchor, mailto, etc).
The popup would return a specially crafted string. The format could be anything, even an actual anchor tag (but JSon is also fine). Example: {href:'tcm:1-2',type='component'}.
Your Templates would interpret this string in order to generate something meaningful, like a dynamic link or static HTML anchor.
Also the Custom URL popup should be smart enough to 'decode' such a link (if a value was specified in that field previously) and maybe pre-populate some attributes in the RTF link constructor form.

How can I embed a Google Docs collection in an Iframe?

I have a Google Docs collection that I would like to embed into an iframe:
https://docs.google.com/open?id=0B6yYgWS-CUJ2ZTUxZGI4MGUtMWM0Yy00YzY0LWIxOTMtMDFlN2RjNDAxNGM2
The problem here is that Google has set the X-Frame-Options header and so it seems they only allow this collection to be embedded into a Google site:
X-Frame-Options: SAMEORIGIN
Now I realize Google's reasons for not allowing their content in iframes some of the time, but this is one case where I feel like it would be nice to have the ability to do this.
With documents Google also allows two methods of "sharing"
You can click on the "Share" button and set visibility, which will give you a link to a document
Or you can click on "Publish to Web" and it will give you a link or an iframe option.
The iframe url is similar to the link URL except that it has the "&embedded=true" query variable at the end. The same thing is true for Google Maps except the parameter is "&output=embed"
Who while I believe there is nothing I can do with headers or Javascript on my site to allow the content of an iframe for a Google Docs collection to load, I was hoping someone might know of a way to generate embed code for a Google Docs collection which would allow it to be loaded in an iFrame.
Update: It looks like Google has allowed embedding Google Docs/Drive items via iFrame. Here are the current headers for that page (note that this URL is after the redirect):
Try these:-
single – setting to true displays just one sheet in the spreadsheet. The default sheet it will display is the first one created in the spreadsheet. This can be changed using ‘gid’ below.
gid – this needs to be a numeric identifier of the sheet you want to display. The first sheet created is 0, but others will have longer identifiers. To find the ‘gid’ for the sheet you want to display, go to the spreadsheet in Google Apps itself, and click on to your desired sheet. The URL in your browser should change to something like this: https://docs.google.com/a/mycompany.com/spreadsheets/d /15B___SOYjsRmU9tiwZly318HZnFHOHeayS6UTHx7Pu2I/edit#gid=419657423
The bit at the end of the URL shows you the ‘gid’ for the sheet, and that is the number you need to bring into the shortcode in your website.
range – set this to the cell range you want to display within the sheet (or leave it out to display the whole sheet). In our example, we set this to f2:g6. Note if you’re being pedantic then you should really change the ‘:’ to ‘%3A’ since colons should be encoded in URLs – but most browsers should understand the colon, so don’t worry. If you like to be correct, you’d use range=f2%3Ag6 instead.
headers=false - Row numbers and column letters are not displayed.
widget – setting this to false removes the sheet selector bar when it’s embedded.
chrome – setting this to false removes the title bar showing the spreadsheet name, above the sheet.
So putting all together:-
<iframe> src="https://docs.google.com/spreadsheets/d/[Googlekey]/pubhtml?gid=28&range=a1:s45&single=true&widget=true&headers=false" </iframe>
Allan

Making sure googlebot is not spamming my mailbox

I have got a website running with an option to report abuse of functionality. This is being done by clicking a link. After the link is clicked the webmaster will get a report of the location where the content is that was reported as abuse. I have added an rel="NOFOLLOW" to the href of the particular links but this is not helping. It seems that this tag is only being used to check wheter a page has to be ranked or not. How can i Exclude googlebot from clicking those abuse links?
This is what a link looks like:
Click me
The way I would go is have the report abuse email be behind a POST form of some kind. For example, a drop down box to select the issue or a text box to write in some comment about the abuse. Another method would be to style the form submit button so that it looked like a link and use that in place of your current link if you didn't want to have another step.
I'd do this in two parts:
By default, I'd make the link take you to a page where you report the abuse via a (very short, friendly) form, one where if you don't want to, you don't even have to choose anything, just click the Report button. Clicking the Report button (or a cancel link) takes you back where you were.
I'd include JavaScript that would test if the user has modern browser features (DOM node creation and such) and, if so, change the action of the link so that when they click it, the form appears right there (in a small overlay box) rather than taking you to a separate page. That makes for a less-intrusive user experience. Either way, though, the end result is a form being submitted rather than simply a link being followed.

Kentico CMS search results

How do I change the Kentico CMS search settings so as to display a part of text from search results as in Google? Presently it shows only the path in the results.
It depends on how you have your search setup really.
At the page level if you are using the Portal Engine model, which the majority of people use now, you have to check the Widget that you are using, basically it boils down to a regular search or Smart Search.
If your using the ASPX Template model you may have to open up your source for the page and see which usercontrol file your using from ~/CMSWebParts/Search/ or ~/CMSWebParts/SmartSearch/
Once you figure out which user control you are using it's a matter of inspecting the Transformation that it uses. Most likely you'll be using one of the following:
CMS.Root.SearchResults
CMS.Root.SmartSearchResults
CMS.Root.SmartSearchResultsWithImages
Click on Edit Transformation and check out which field is inside the Call to SearchHighlight, normally, "Content". Then you know it's pulling from the main content of the document. I've also seen this be tied to a different field like "Title" or "Caption". But the default is "Content".
If you still dont see results with part of the text, make sure you have a Smart Search Index setup, found in CMSSiteManager -> Administation -> Smart Search. If you don't see your site in the Index list then you need to add one. Make sure you rebuild it and optimize it (click edit on the row to get to those options). After that is all rebuilt then you should see the text appear under the result.
One thing to note, is that as #jao has mentioned, this only takes the first 280 characters of the content of the page. If you're matching search text doesn't happen to be in the first 280 characters, then no highlighting will occur.
try the following in your search result transformation:
<p>
<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"),"")),false, " ")), 280, "...")),"<span style=\"background-color: #FEFF8F\">","</span>") %>
</p>
This will show the first 280 characters from your content, with the search terms highlighted.

Resources