Talk:Site development: Difference between revisions

From Rejoice in the Catholic Faith
No edit summary
Line 59: Line 59:
Choose the method that best fits your MediaWiki configuration and your level of access to the site's backend.
Choose the method that best fits your MediaWiki configuration and your level of access to the site's backend.
</pre>
</pre>
== <PRE> Tag extends text off right margin on Browser read mode ==
5/24: no solution yet

Revision as of 11:32, 23 May 2024

FIXED Blog pages max width and font size

resolved via Common.css < see notes there issue was mobile was not liking the center and margin 0 auto and pushed text to the left FIX: make the css rule only for screns ove 850 << see common.css

Common header for Blog namespace

ChatGTP suggests:

To include a template at the top of every page in a specific namespace in MediaWiki, you can use the `MediaWiki:Common.js` or `MediaWiki:Common.css` to add JavaScript or CSS that injects the template. Alternatively, you can use the `MediaWiki:CommonHeader` page if it’s supported in your MediaWiki installation.

Here’s a method using JavaScript:

1. **Edit `MediaWiki:Common.js`**:
   - Go to the page `MediaWiki:Common.js` on your wiki.
   - Add the following script:

```javascript
// Add template to the top of every page in a specific namespace
$(document).ready(function() {
    // Replace '3000' with your namespace number
    if (mw.config.get('wgNamespaceNumber') === 3000) {
        // Replace 'Template:YourTemplateName' with the template you want to include
        var template = '{{YourTemplateName}}';
        
        // Create a new div to hold the template
        var templateDiv = $('<div></div>').html(template);
        
        // Prepend the template to the content
        $('#content').prepend(templateDiv);
    }
});
```

2. **Edit `MediaWiki:Common.css`** (Optional):
   - Go to the page `MediaWiki:Common.css` on your wiki.
   - Add any additional CSS to style the injected template if necessary.

Here’s a method using the `MediaWiki:CommonHeader` page (if supported):

1. **Create `MediaWiki:CommonHeader` for the specific namespace**:
   - Go to the page `MediaWiki:CommonHeader/Namespace_3000`.
   - Add the template you want to include at the top of every page:

```plaintext
{{YourTemplateName}}
```

This method might require your MediaWiki to have the necessary extensions or configurations to support namespace-specific headers.

### Explanation:
- **JavaScript Method**: This script checks if the current namespace matches the specified number (`3000` in this case). If it does, it injects the specified template at the top of the content area.
- **CommonHeader Method**: This approach uses MediaWiki’s built-in capabilities (if available) to add a common header to all pages in a namespace by creating a `MediaWiki:CommonHeader/Namespace_X` page.

Choose the method that best fits your MediaWiki configuration and your level of access to the site's backend.

 Tag extends text off right margin on Browser read mode

5/24: no solution yet