Updating part of text across multiple pages


#1

We have dates on our sites which are used across multiple pages. Some are used in a table, some within a sentence etc.

Ie. On 30 June, all applications…etc.

Is there a way of setting up a single source so we can update in one place? I had a look at snippets, but that seems like its for sections of content.

Metadata seems like the right way (with using keyword replacements where the dates are) but I’m hitting a blank as how to do it. IE. What asset type would I use as the source to update all fields at once.


(Tom Stringer) #2

You could set up a standard page, then for each content snippet you want to reuse, add it as a separate content container on that page.

Then to reuse on a different asset, use %globals_asset_contents_raw:12345% (where 12345 is the asset ID of the content container itself).


#3

Thanks for that.

I suppose if I want to just update part of a sentence, then the whole paragraph or sentence should go in a snippet.


#4

We have used Data Record assets to store common values in metadata, and then referred to them inline, example:

A processing fee of %globals_asset_metadata_Fee:12345% applies.

In this case we used one metadata field across multiple assets (ie using the assetid to specify the particular fee), but you could also use one asset with multiple, well named metadata fields.

We store the Data Record assets outside of the Site so that they don’t get URLs, adding the folder where they are stored into the ‘assetFinderLocations’ Edit+ configuration, so our editors can get to them easily.

This works fine, but in either case the keywords can get pretty long, which isn’t great for inline editing. If you’re after something succinct and don’t have many of them, you could use a replace modifier on the contents keyword in the paint layout. For example (using the token **disclaimer**):

Directly in paint layout (not best idea):

%asset_contents^replace:\*\*disclaimer\*\*:Disclaimer text here%

Using metadata (as above):

%asset_contents^replace:\*\*disclaimer\*\*:{globals_asset_metadata_Disclaimer:12345}%

Or using an asset’s contents:

%asset_contents^replace:\*\*disclaimer\*\*:{globals_asset_contents_raw:12345}%

I tested this with handlebars like syntax {{disclaimer}} and it works, but as curly brackets are used for matrix nested keywords, probably best to use a different syntax.


#5

So each piece of content that needs to be repeated is stored in an individual data record asset?
IE. I have 5 dates, so would need 5 data records?


#6

Either 5 data records, or 5 metadata fields on 1 data record.


#7

Hiya bkelly, I’d be interested why you did this? (URL avoidance).

Cheers


#8

Data records can be viewed like a page, if you don’t design for that and they just inherit a standard paint layout/ design, they can effectively be viewed as a blank page on the frontend. For the most part this isn’t a problem if they are TYPE2’d and not discoverable, but, we’ve had instances where things have become discoverable for one reason or another, this just removes that possibility.


#9

Thanks for expanding on that. Good tip Cheers!

Agree, always good to remove the ever mysterious non-intended asset discovery conundrum :persevere:.