Matomo, aggregate stats for pages in all subfolders - matomo

I have an app with identical pages that can be reached by different "groups", so my urls are like :
/group1/page1/
/group1/page2/
/group2/page1/
/group2/page2/
Is there a way to view the stats for all pages no matter the groupe ?
ie. all stats for "page1" and "page2" ... ?
Thanks a lot !

If the page titles are the same, then you should be able to see the reports for the page titles under the Behaviour > Page titles report
Alternatively you can set the page title with the Javascript tracker using:
_paq.push(['setCustomTitle', '']
You can also use the instructions provided for Single-Page Application tracking in the Developer Docs to set a custom page URL
_paq.push(['setCustomUrl', '/url/here']);
You can find more information on setting custom page titles and URLs here: https://developer.matomo.org/guides/spa-tracking

Related

In WagTail, how do you display a full document url for document links embedded in richtext?

I'm setting up a wagtail site which needs to display all links as full urls since the pages will also be used as email templates.
Wagtail version 2.5.1
My main issue is document links which are embedded in RichTextFields. The current work around is to have them inserted as external links after they upload the documents.
I've looked at features.register_link_handler but am unclear on how to deal with Document links. I'm assuming that it will need to be in wagtail_hooks.py register_rich_text_features somehow.
I ended up creating a register_rich_text_features link handler for this in wagtail_hooks.py
class DocumentFullLinkHandler(DocumentLinkHandler):
#classmethod
def expand_db_attributes(cls, attrs):
try:
document = cls.get_instance(attrs)
current_site = Site.objects.get_current()
document_url = (
document.url
if document.url.startswith(settings.PATH_PREFIX)
else f"{settings.PATH_PREFIX}{document.url}"
)
full_url = f"https://{current_site.domain}{document_url}"
return f'<a href="{escape(full_url)}">'
except (ObjectDoesNotExist, KeyError):
return "<a>"
The real answer is to Upgrade to Wagtail 2.7 and then set
WAGTAILDOCS_SERVE_METHOD = "direct" in the settings.
This will provide the direct document when using remote storage.
#sw12k I tried to apply your same solution and I couldn't make it work, but... I think I found a much simpler solution that actually made the trick.
In the html template, when you render your RichTextField I moved from:
{{ page.description|safe }}
to this:
{{ page.description|richtext }}
And now document links are well formatted and download links work fine.
Hope it helps.

How to make facebook crawler loads page dynamic title / description?

My little application is written in reactjs, on a page it will update title / description based on the real object that user selected like this photo. The new title and description are display correctly but when sharing on fb, the values are not loaded correctly (the value is from old html templated) - go to facebook and paste the url or use fb debugger the values are from static html page.
Have anyone had this issue and have "fixed" it ?
Thanks for any recommendation !
Facebook ignores JavaScript, so dynamic OG tags are not possible. You can solve this with Server Side Rendering or https://prerender.io/, for example.
You can pass as parameter in url (abc.com?title=awesome&desc=flower), and in og tags use that parameter to make dynamic.

Blogger Mobile Blog Posts Gadget

I have started a blog for a local group that I volunteer with so that we can communicate with the public, post information about ourselves, and provide a means for the public to get in touch with us. (www.wildwindflutechoir.com)
At the request of the organizer for the group, I have modified the "Blog Posts Gadget" so that it only shows 1 post and have removed any widgets that displayed "popular posts" or "past posts". This way only the most recent information/article is displayed on the home page and the other pages in the site (like the about-us page) don't have old posts lingering around. The main goal was to no longer display information posted about our Christmas activities on our homepage (or elsewhere in the website) now that Christmas is done...unless, of course, you browse to it through the archive links.
This works fine on desktop browsers; however, when I am viewing the website with a mobile device (or by adding the /?m=1 parameter to the URL)...the home page lists all of the posts.
I cannot figure out how to have it simply display the 1 most recent post instead of this list...Nor can I figure out how to have it automatically display the full details of most recent post (instead of a preview)
Please provide some advise on how to modify the Home page of my Blogger blog so that it only displays 1 post in mobile view (and preferably the whole post instead of a preview of it)
Update
I applied the suggested solution to hard code the number of posts shown to 1. I also, in the case that it is the index page (home page), modified it so that the full post was displayed instead of the mobile index. I considered displaying both the link to the post along with the full details about the post because I discovered that you cannot navigate to older posts in the mobile version on the home page (you had to be viewing a post for it to detect that there is older content).
After customizing the navigation, and failing to get it to work like the desktop version, I decided to just live without it for the mobile for the time being. At least it is closer to what was requested: show only the most recent content. I will have to return to this navigation problem another day.
The following will show both the link to the most recent post along with the full content of the post:
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<b:if cond='data:blog.pageType == "index"'>
<b:loop values='data:posts limit 1' var='post'>
<b:include data='post' name='mobile-index-post'/>
<b:include data='post' name='mobile-post'/>
</b:loop>
<b:else/>
<b:loop values='data:posts' var='post'>
<b:include data='post' name='mobile-post'/>
</b:loop>
</b:if>
</div>
But this is what I currently have so that only the full content is displayed for the most current post :
<!-- posts -->
<div class='blog-posts hfeed'>
<b:include data='top' name='status-message'/>
<b:if cond='data:blog.pageType == "index"'>
<b:loop values='data:posts limit 1' var='post'>
<b:include data='post' name='mobile-post'/>
</b:loop>
<b:else/>
<b:loop values='data:posts' var='post'>
<b:include data='post' name='mobile-post'/>
</b:loop>
</b:if>
</div>
This is a known bug in the mobile templates. If the post count is set to less than 5 posts, then the mobile homepage will always show minimum 5 posts irrespective of whether it is a custom mobile template or not. On all the further pages (accessible via Next post links), the count set via the settings will be respected
A partial solution to this problem is to switch to Custom mobile templates and then make the following changes to the template code -
<b:loop values='data:posts limit 1' var='post'>
<b:include data='post' name='mobile-index-post'/>
</b:loop>
Other than this, Lambda expressions can also be used -
<b:loop values='data:posts first(p => p)' var='post'>
<b:include data='post' name='mobile-index-post'/>
</b:loop>
This will visually resolve the issue of displaying only a single post but the next page link rather than redirecting to the 2nd post will redirect to the 6th post (the 2nd-5th post gets skipped)
What about using a responsive theme like Contempo
Showing Widget In Mobile Page In Blogger:<!-- Here Is Your Widgey-->
</b:if>
Hiding Widget In Mobile Page In Blogger:<b:if cond='data:blog.isMobileRequest == "false"'>
<!-- Here Is Your Widgey-->
</b:if>
See in Detail
How To Show / Hide Widget In Mobile Page In Blogger

Append content of field to title field in Wagtail-CMS-admin

In order to differentiate pages in Wagtail CMS admin (in a page listing view, not in the edit page view), the title is - in my case - not enough. I have a long list of pages of one page-type (say class BlogPage), and some of these pages could have the same title. So I would like to add a second identifying field (here: date_from, a DateField) to this title.
I thought of
class BlogPage(Page):
...
def title(self):
if self.date_from:
return self.date_from + " - " + self.title
else:
return self.title
but this does not work, the page.title without my def is used for the corresponding Wagtail-admin-template.
Short version: How to pre/-append an existing field to the title in Wagtail-admin?
If you'd like to replace the title across all of the model admin (Yes, this includes the Edit page), Wagtail has a built in mechanism for that.
def get_admin_display_title(self):
return '{} - {}'.format(self.date_from, super().get_admin_display_title())
title is an actual Django model attribute, don't try to override it: https://docs.djangoproject.com/en/dev/topics/db/models/#field-name-hiding-is-not-permitted
The actual admin template from wagtailadmin/pages/list.html generates the list of pages in a loop using {% for page in pages %} and calls {{ page.title}} via an include (templates/wagtailadmin/pages/listing/_page_title_explore.html) extensively throughout. So based on inspecting the code, there is no support for this in Wagtail itself. Check the other includes templates/wagtailadmin/pages/listing/*.
However, Django supports overriding one app's templates with your own. You can copy this template into your project's template folder, keeping the same path (e.g., templates/wagtailadmin/pages/listing/_page_title_explore.html assuming your project is set up with a templates directory).
You'll have to replace the calls to page.title with your own version. A filter or tag might make this easier. Add the following filter to your templatetags (e.g. myapp/templatetetags/myapp_tags.py):
register = template.Library()
#register.filter
def uniquify_title(page):
specific_page = page.specific
try:
return specific_page.date_from.strftime("%Y-%m-%d") + " - " + specific_page.title
except AttributeError:
return specific_page.title
And then replace usages of {{ page.title}} in the template starting around line 7 and 9 with:
{{ page|uniquify_title }}
The downside of this is you have to update your own version of list.html every time Wagtail is updated. You could try submitting an issue on Github and proposing a fork which supplies an "admin_title" callable or something like that.
wagtailmodeladmin seems to do exactly what I've searched for: extending the wagtailadmin to display a defined set of fields - not only title - on a page model basis; like I would have it in the Django admin site.
This way I do not alter the default wagtailadmin page listing - like I've tried it in my question, but hook in an additional page listing as an extra wagtail-sidebar-navigation-entry.
Thanks to an other answer I stumbled upon this possiblity.

Can we have links of related lists in a VF page

I have a VF page in which i have related lists displayed using
<apex:relatedList list="NOTESANDATTACHMENTS"/>
Is there a way i can have the link of the related list on the top of the page like the ones in standard page? The reason for this is that my VF page is pretty long and the user needs to scroll to get the view the notes and attachment list.
is there any way we can achieve this?
Thanks
Not directly, but you can always use anchor links.
Go to related list
...
<a id="mylist" />
<apex:relatedList list="NOTESANDATTACHMENTS"/>
The relationship name for the Notes and Attachments related list has been changed in winter 14 release.
you can show the attachement in the relatedlist tag.
apex:relatedList list="CombinedAttachments" subject="{!$CurrentPage.parameters.id}"
in the VF page if you are using Standard controller then there is no need to add subject attribute.

Resources