Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
We have a requirement that when page is opened with query parameter wcmmode=(disabled | preview), then links on that page should also open in same mode.
Does anyone know how to achieve this?
Its working as expected for wcmmode=preview, but for wcmmode=disabled all the links on that page are opening in preview mode.
Any pointers would be helpful.
Thanks!
Gelöst! Gehe zu Lösung.
Zugriffe
Antworten
Likes gesamt
I think the below design should help you
You need to rewrite all href link on the page by appending wcmmode=disabled,
Check below sample code :
public void startElement(String uri, String loc, String raw, Attributes attributes) throws SAXException {
AttributesImpl attrs = new AttributesImpl(attributes);
for (int i = 0; i < attrs.getLength(); i++) {
String name = attrs.getLocalName(i);
if(name.equals("href"))
{
String url = attrs.getValue(i);
// write an if condition to check url endwith wcmmode or not
/ if so then rewrite th url something like below
url = "http://keysandstrokes.info?wcmmode=disabled";
//finally set value back to the href attribute
attrs.setValue(i, url);
}
}
super.startElement(uri, loc, raw, attrs);
}
Example: you can use it as it is by applying your logic in the start element
http://keysandstrokes.info/apache-sling-rewriter-how-to-rewrite-urls-in-aemcq5/
Approach 2:
You can also do this using Jquery, but you must have knowledge of it. Using Jquery find out all href links and rewrite it, this is simple than approach 1 and it will not put any burden on the server as it is authoring environment so we can consider this. the Jquery should load at end of the page once the entire DOM is loaded.
You need to load Jquery only in author mode don't execute on publish mode.
Approach 3 :
Check is there any OOTB functionality available or not, if not then try above approaches.
What AEM version are you using?
Zugriffe
Antworten
Likes gesamt
Why you need to do this ? In author if you want to simulate something similar, one quick way to do it is removing editor.html from your URL . Something like http://localhost:4502/content/website/en_US/home.html . This will open all the corresponding links in preview mode only
Zugriffe
Antworten
Likes gesamt
yes, thats right. But i believe this works for simple components like text image etc. But in case we have an accordion or other similar components the functionality wouldn't work well only by removing editor.html. we would also need to append ?wmcmode-disabled in the url.
Zugriffe
Antworten
Likes gesamt
AEM 6.4
Zugriffe
Antworten
Likes gesamt
You can do this with customization but before that please check once is it really required? if so I can put a design for this.
Zugriffe
Antworten
Likes gesamt
Yes.. This is business requirement.
Zugriffe
Antworten
Likes gesamt
As other community members point out - this is not OOTB.
Zugriffe
Antworten
Likes gesamt
I think the below design should help you
You need to rewrite all href link on the page by appending wcmmode=disabled,
Check below sample code :
public void startElement(String uri, String loc, String raw, Attributes attributes) throws SAXException {
AttributesImpl attrs = new AttributesImpl(attributes);
for (int i = 0; i < attrs.getLength(); i++) {
String name = attrs.getLocalName(i);
if(name.equals("href"))
{
String url = attrs.getValue(i);
// write an if condition to check url endwith wcmmode or not
/ if so then rewrite th url something like below
url = "http://keysandstrokes.info?wcmmode=disabled";
//finally set value back to the href attribute
attrs.setValue(i, url);
}
}
super.startElement(uri, loc, raw, attrs);
}
Example: you can use it as it is by applying your logic in the start element
http://keysandstrokes.info/apache-sling-rewriter-how-to-rewrite-urls-in-aemcq5/
Approach 2:
You can also do this using Jquery, but you must have knowledge of it. Using Jquery find out all href links and rewrite it, this is simple than approach 1 and it will not put any burden on the server as it is authoring environment so we can consider this. the Jquery should load at end of the page once the entire DOM is loaded.
You need to load Jquery only in author mode don't execute on publish mode.
Approach 3 :
Check is there any OOTB functionality available or not, if not then try above approaches.
You can try out Rajas approaches if its a real need. Recommend not to do such customization as you have a publish whose job is to render your final content . Its always best to verify content of any working page in preview mode and then publish it and verify the final content in your publish.
Zugriffe
Antworten
Likes gesamt
Actually, I feel this is also a good requirement without replicating to publish environment you can check it on author instance itself, this is very useful when you want to make authoring productivity high
Zugriffe
Antworten
Likes gesamt
Thanks rajas66269496!
I am looking for OOTB feature to do this..
Zugriffe
Antworten
Likes gesamt
As per Scott there is no ootb functionality
Zugriffe
Antworten
Likes gesamt
Hi
Just wanted to know
is AEM 6.5 is unstable?
I am trying to create the form and integrate with the REST endpoint , via email, pdf, prefill adaptive forms.
Nothing is working out for some reason.
is 6.5 not stable?
Thanks
Zugriffe
Antworten
Likes gesamt
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten