Add a custom page to repository, what to use? servlet? or any AUI components

I’m trying to add a custom page once a button is clicked on a repository and then load the response from API call which I’ll be making using javascript (client-side) on it. I was wondering if I have to use servlet or if using AUI component page Page - AUI Documentation will serve the purpose?

Any thoughts? I’m using Bitbucket Server and trying to achieve this using plugin framework.

@madamczak - Any thoughts?

You can discover plugin-points buy loading the page with the Web Fragments query parameters ?web.items&web.panels&web.sections and see which sections and panels are available.


The screen you posted looks more like Bitbucket Cloud than Server/DC version.

If you want to add a new page with a custom URL then the servlet is a way to go:

Bitbucket includes a few custom page layout (page decoarators) that you can use:

If you want to extend only part of Bitbucket UI by adding e.g. new panel, then you can use the suggested link to read more about WebFragments.

@madamczak - Yeh, the screenshot is of Bitbucket cloud, however, I’m trying to add a custom page on Bitbucket Server. Let me give it a try with plugin-decorators. Thank you.

@madamczak -

I don’t find any place/area using webfragments to add a web panel. I want a panel/page to be added where you see ‘this is the symlink target’ in the screenshot i.e. file view. and rest controls would remain as is like Edit, Rawfile, Source View, etc.

I want my own context to load on the below-highlighted area, the way the content gets changes when ‘Diff to previous’ button is clicked.

  1. I believe if I go with Servlet, it will add a new page and won’t fit the file view, it will remove the controls/button like raw file, edit, blame, Diff to previous
  2. When I follow the example Repository decorator from Bitbucket I see it adds a new page (using servlet)

Is there any way to add a new panel/page to the existing file view within the browser?

The selected UI box is called a file view or a diff view, depending on the state. As far as I’m aware there is no official API you can use to extend it.

@madamczak - How about using a file handler? I’m not sure whether that will serve my purpose. Bitbucket Server Developer Documentation -

I tried though adding an example given on above URL, but looks like I’m missing something to import as it is showing error at"required(‘feature/file-content/file-handlers’)"

here is the javascript code

AJS.toInit(function() {
    AJS.$("#dialog-show-button").click(function(e) {


        //import HandlerRegistry from 'bitbucket/internal/util/handler-registry';
        //import object from 'bitbucket/internal/util/object';

        console.log("Start of Plugin");
        alert("hey darling, love you!");

        function MyView(options) {
            var $element = $('<div/>');
            return {
                destroy: function() {
                extraClasses: 'my-class something-else'
        var myFileHandler = {
            weight: 400,
            handle: function(options) {
                console.log("I'm in handle")
                if (options.fileChange.path.extension === 'txt') {
                    return new MyView(options);
                } else if (options.fileChange.path.extension === 'txt2') {
                    return $.Deferred().reject('File extension not supported');

        console.log("before register");


  <web-panel key="my-panel" location="bitbucket.web.repository.browse.filebrowser.before">
    <resource name="view" type="velocity" location="/templates/new.vm" />

Error in console, and I dont find any relevant information when I google.

I’m adding a button at the repo level and trying to trigger that JS script on click.

Sorry if I’m deviating from my original question, I’m trying to render the content of files (from repo) with extension .properties which has key-value pair, and then apply additional logic to hyper link keys.

Can you please suggest?

@madamczak - I see API listed as other API “Web Resource context” * which let you render custom data through css/javascript to the core pages, and the context available for file/diff view - “”. I hope this will help in my use case.

I tried though adding the web-resource only with the above context and the javascript which just outputs using document.write but I get a weird view on file/diff file of any file from the repository, I have raised that under another issue.