Automatically formatting links


(Tim Davison) #1

I'm not sure this is possible, but is there a way to get links to internal assets automatically formatted a certain way? I've looked at Snippets (only allows static content) and Paint Layouts (looks like I would need to create Link assets for each PDF).


To describe what I'm trying to achieve, we have a large group of distributed authors (approx 150 or so). I want all links to PDF assets to be formatted the same way on the site, which is a PDF icon on the left, followed by the document name, and then info like '[PDF, 23KB, 14pp]'. Is there some way to allow authors to create a link and point to the PDF asset and the link code automatically generated? Items like number of pages, etc are guaranteed to be there - we force it through metadata.



I realise there would be nothing to stop authors doing their own thing, but all authors will receive training, etc, and with such a large author base it is easier to provide a single, easy way to do it, and chase up the few that just want to do it their own way (rather than helping 150 authors create links from scratch).



Thanks


(Chiranjivi Upreti) #2

You can use following keywords in the type format bodycopy:


%asset_type_icon% <a href="./?a=%asset_assetid%">%asset_name%</a> %file_type^uppercase%, %asset_file_size_in_bytes^divide:1024^round:2% KB



Or alternatively you can use a special keyword %asset_summary_<FILE ASSETID>%. The output for this keyword can be customized in System Configuration > File Prefs > File Summary Format.



Chiran


(Josh Sherwood) #3

[quote]
Or alternatively you can use a special keyword %asset_summary_<FILE ASSETID>%. The output for this keyword can be customized in System Configuration > File Prefs > File Summary Format.

[/quote]



This keyword can be automatically printed when adding links by using the Include Summary checkbox (added in v3.28.3). As Chiran mentioned, the summary of the file link can be configured on the Global Preferences screen (File Summary Format field).



You can find more info in our documentation here. This feature was also outlined in here.


(Dave Letorey) #4

Hi Quimby


Another alternative to this would be to train your users to use the class field in the insert link popup







Dave


(Tim Davison) #5

Thanks everyone. I have solved my problem with your help, I'll describe my solution in case others can learn from it.


I followed the advice from Chiranjivi Upreti, and changed the File Summary Format to:

    %asset_type_icon% %asset_attribute_name% [%file_type^uppercase%, %asset_file_size_in_bytes^divide:1024^round:2% KB, %asset_metadata_link_summary%]


This renders the summary how I want. Users (in EES) just click insert link and find the asset in the tree. The only extra step for users is tick 'Include Summary' (we also set new window to 'Yes', but that's arbitrary).

The issue I found was rendering page counts for PDF's. Page count is already a required field in our metadata schema, but the file summary applies to ALL file types, and for most page count will not make sense. To overcome this, I've added an additional field in the metadata called 'link_summary'. For each schema (we will have one for each file type) we define this field, make it not editable, and in the default value use keyword replacement from the other metadata values. So the user fills in the metadata values, and link_summary automatically renders itself (and more importantly, renders it the way WE want it to).

E.g. for our 'Document' schema, the default value for link_summary is '%metadata_field_pagecount% pages'.

A schema for images will have different fields for authors to fill in, and the formatting of the link_summary field will be different, but the link_summary field will be available.

This meets all of our needs:
- Easy for users to create a link and link code automatically populated.
- Links are formatted specific to their asset type and are consistent.
- We (admins) can enforce a central, consistent format.

Thanks again for your help.